GCC Code Coverage Report


Directory: src/
File: src/cmdline/jnamespaces-main.cpp
Date: 2025-10-24 11:14:59
Exec Total Coverage
Lines: 12 19 63.2%
Functions: 1 1 100.0%
Branches: 3 6 50.0%

Line Branch Exec Source
1 /* Copyright 2025 Jonathan S. Arney
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * https://github.com/jarney/gyoji/blob/master/LICENSE
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "jformat-identity.hpp"
16 #include <gyoji-misc/input-source-file.hpp>
17
18 using namespace Gyoji::context;
19 using namespace Gyoji::frontend;
20 using namespace Gyoji::frontend::tree;
21 using namespace Gyoji::frontend::namespaces;
22 using namespace Gyoji::cmdline;
23
24 48 int main(int argc, char **argv)
25 {
26
27
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 if (argc != 2) {
28 fprintf(stderr, "Invalid number of arguments %d\n", argc);
29 fprintf(stderr, "Usage: parser backend file\n");
30 exit(1);
31 }
32
33 48 int input = open(argv[1], O_RDONLY);
34
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 if (input == -1) {
35 fprintf(stderr, "Cannot open file %s\n", argv[1]);
36 exit(1);
37 }
38
39 48 CompilerContext context(argv[1]);
40
41 48 Gyoji::misc::InputSourceFile input_source(input);
42
43 Gyoji::owned<ParseResult> parse_result =
44 Parser::parse(
45 context,
46 input_source
47 48 );
48 48 close(input);
49
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
48 if (parse_result->has_errors()) {
50 parse_result->get_errors().print();
51 return -1;
52 }
53
54 48 parse_result->get_ns2_context().dump();
55
56 48 return 0;
57 48 }
58