Conditions | 2 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 2 |
Changes | 0 |
1 | """ |
||
37 | 1 | def process(self, infile, outfile): |
|
38 | """ |
||
39 | Processes a SDoc1 document. |
||
40 | |||
41 | :param str infile: The input filename with the SDoc1 document. |
||
42 | :param str outfile: The output filename with the SDoc2 document. |
||
43 | |||
44 | 1 | :rtype: int |
|
45 | """ |
||
46 | 1 | in_stream = antlr4.FileStream(infile) |
|
47 | 1 | ||
48 | 1 | self._io.writeln('Writing <fso>{0!s}</fso>'.format(outfile)) |
|
49 | 1 | with open(outfile, 'wt') as out_stream: |
|
50 | 1 | lexer = sdoc1Lexer(in_stream) |
|
51 | 1 | tokens = antlr4.CommonTokenStream(lexer) |
|
52 | parser = sdoc1Parser(tokens) |
||
53 | 1 | tree = parser.sdoc() |
|
54 | |||
55 | 1 | visitor = SDoc1Visitor(self._io, root_dir=os.path.dirname(os.path.realpath(infile))) |
|
56 | 1 | ||
57 | visitor.output = out_stream |
||
58 | 1 | visitor.visit(tree) |
|
59 | |||
60 | return visitor.errors |
||
61 | |||
63 |