Skip to content

Stable parsing APIs #3373

Closed
Closed

Description

@pekkaklarck

RF 3.2 introduces a new parser (#3076). This issue covers exposing its APIs publicly and includes API design, implementation, tests, and documentation. We should provide at least these APIs:

  • API to get all tokens in a certain *.robot file. It should be possible to pass content as a file system path, opened file object, or string. Makes it easy to create syntax highlighters and tools that operate on very low level data.

  • Higher level model that represents test data on file system. Should probably have access to the underlying tokens as well. This will replace the old parsing model. Should accept input as paths, file objects and strings same way as the lower level token API.

Activity

  1. added this to the v3.2 milestone on Nov 12, 2019
  2. added a commit that references this issue on Jan 11, 2020
  3. pekkaklarck commented on Jan 12, 2020

    @pekkaklarck
    MemberAuthor

    The robot.parsing module now has get_tokens for getting tokens and get_model for getting a higher level model. The latter is implemented using the Python ast module and can be investigated and modified using tools like ast.dump(), ast.NodeVisitor and ast.NodeTransformer. Documentation for these new APIs are still somewhat lacking, but #3293 takes care of improving them before the final release.

  4. pekkaklarck commented on Jan 22, 2020

    @pekkaklarck
    MemberAuthor

    The above commits added also TestSuite.from_model and TestSuite.from_file_system convenience methods. The former allows creating an executable test suite based on the parsing model returned by get_model. The latter provides exactly the same functionality as TestSuiteBuilder that it uses internally but may be a bit more convenient to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions