|
13 | 13 | # See the License for the specific language governing permissions and
|
14 | 14 | # limitations under the License.
|
15 | 15 |
|
16 |
| -# FIXME misleading maybe?? |
17 | 16 | """Implements test data parsing.
|
18 | 17 |
|
19 |
| -Classes :class:`~.model.TestCaseFile`, :class:`~.model.TestDataDirectory` |
20 |
| -and :class:`~.model.ResourceFile` represented parsed test data. Objects |
21 |
| -of these classes can be modified and saved back to disk. In addition, |
22 |
| -a convenience factory function :func:`~.model.TestData` can be used to |
23 |
| -parse a test case file or directory to a corresponding object. |
| 18 | +Main entry points to parsing are the following: |
24 | 19 |
|
25 |
| -Aforementioned classes and functions are part of the public API. It is |
26 |
| -recommended that they are imported through the :mod:`robot.api` package |
27 |
| -like in the example below. |
| 20 | +* :func:`~.lexer.get_tokens` and :func:`~.lexer.get_resource_tokens` |
| 21 | + for parsing test data to tokens. |
28 | 22 |
|
29 |
| -This package is likely to change radically in Robot Framework 2.9. The main |
30 |
| -motivation for the planned changes is making the data easier to use for |
31 |
| -external tools that use these modules. |
| 23 | +* :func:`~.builders.get_model` and :func:`~.builders.get_resource_model` for |
| 24 | + parsing test data into a model represented as an abstract syntax tree (AST). |
| 25 | +
|
| 26 | +*TODO:* Document how to modify the returned model using |
| 27 | +:class:`~.model.ModelVisitor` and :class:`~.model.ModelTransformer`. |
| 28 | +Also mention that the model as well as tokens are part of the public API. |
| 29 | +
|
| 30 | +Like with rest of the public API, these functions and classes are exposed |
| 31 | +also via :module:`robot.api`. |
| 32 | +
|
| 33 | +The :module:`robot.parsing` package has been totally rewritten in Robot |
| 34 | +Framework 3.2 and all code using it needs to be updated. Depending on the |
| 35 | +use case, it may be possible to use the :func:`robot.running.TestSuiteBuilder` |
| 36 | +that has not changed instead. |
32 | 37 |
|
33 | 38 | Example
|
34 | 39 | -------
|
35 | 40 |
|
36 | 41 | ::
|
37 | 42 |
|
38 |
| - import sys |
39 |
| - from robot.api import TestData |
40 |
| -
|
41 |
| - def print_suite(suite): |
42 |
| - print 'Suite:', suite.name |
43 |
| - for test in suite.testcase_table: |
44 |
| - print '-', test.name |
45 |
| - for child in suite.children: |
46 |
| - print_suite(child) |
47 |
| -
|
48 |
| - suite = TestData(source=sys.argv[1]) |
49 |
| - print_suite(suite) |
| 43 | + TODO |
50 | 44 | """
|
51 | 45 |
|
52 | 46 | from .builders import get_model, get_resource_model
|
53 | 47 | from .lexer import get_tokens, get_resource_tokens, Token
|
54 |
| -from .model import ModelTransformer |
| 48 | +from .model import ModelTransformer, ModelVisitor |
55 | 49 | from .suitestructure import SuiteStructureBuilder, SuiteStructureVisitor
|
0 commit comments