You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
Activity
Utf8Reader: Support input as text and rename to FileReader
Parsing: Support getting tokens using open file objects and text
Expose stable parsing API (#3373).
pekkaklarck commentedon Jan 12, 2020
The
robot.parsingmodule now hasget_tokensfor getting tokens andget_modelfor getting a higher level model. The latter is implemented using the Python ast module and can be investigated and modified using tools likeast.dump(),ast.NodeVisitorandast.NodeTransformer. Documentation for these new APIs are still somewhat lacking, but #3293 takes care of improving them before the final release.Implement TestSuite.from_model.
Implement TestSuite.from_file_system
pekkaklarck commentedon Jan 22, 2020
The above commits added also
TestSuite.from_modelandTestSuite.from_file_systemconvenience methods. The former allows creating an executable test suite based on the parsing model returned byget_model. The latter provides exactly the same functionality asTestSuiteBuilderthat it uses internally but may be a bit more convenient to use.Don't expose robot.parsing.ModelVisitor/Transformer via robot.api
Document new parsing API.
Utf8Reader: Support input as text and rename to FileReader
Parsing: Support getting tokens using open file objects and text
Expose stable parsing API (robotframework#3373).
Implement TestSuite.from_model.
Implement TestSuite.from_file_system
Don't expose robot.parsing.ModelVisitor/Transformer via robot.api
Document new parsing API.