Conditions | 1 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 19 |
Ratio | 100 % |
Tests | 10 |
CRAP Score | 1 |
Changes | 0 |
1 | 1 | import antlr4 |
|
27 | 1 | def process(self, infile: str) -> int: |
|
28 | """ |
||
29 | Processes a SDoc1 document and returns the error count. |
||
30 | |||
31 | :param str infile: The input filename with the SDoc2 document. |
||
32 | """ |
||
33 | 1 | in_stream = antlr4.FileStream(infile, 'utf-8') |
|
34 | |||
35 | 1 | lexer = sdoc2Lexer(in_stream) |
|
36 | 1 | tokens = antlr4.CommonTokenStream(lexer) |
|
37 | 1 | parser = sdoc2Parser(tokens) |
|
38 | 1 | tree = parser.sdoc() |
|
39 | 1 | visitor = SDoc2Visitor(infile, self._io) |
|
40 | |||
41 | 1 | visitor.visit(tree) |
|
42 | |||
43 | 1 | sdoc2.node_store.prepare_content_tree() |
|
44 | |||
45 | 1 | return visitor.errors |
|
46 | |||
48 |