Skip to content

Commit

Permalink
Expose the pg_query_scan() function as parser.scan()
Browse files Browse the repository at this point in the history
This is a preliminary implementation of the first step mentioned in commit
#23 (comment) of issue #23.
  • Loading branch information
lelit committed Apr 25, 2021
1 parent c5ec7fc commit 55aed47
Show file tree
Hide file tree
Showing 5 changed files with 1,820 additions and 616 deletions.
20 changes: 20 additions & 0 deletions docs/parser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ underlying ``libpg_query`` library it links against.
Parse the given `query`, a string with the ``plpgsql`` statement(s), and return the
``libpg_query``\ 's ``JSON``\ -serialized parse tree.

.. function:: scan(query)

:param str query: The SQL statement
:returns: sequence of tuples

Split the given `query` into its *tokens*. Each token is a `namedtuple` with the following
slots:

start : int
the start offset

end : int
the end offset

name : str
the name of the offset

keyword : str
the keyword kind

.. function:: split(query, with_parser=True, only_slices=False)

:param str query: The SQL statement
Expand Down
Loading

0 comments on commit 55aed47

Please sign in to comment.