GCC Code Coverage Report


Directory: ../
File: src/ast/ASTBuilder.h
Date: 2024-12-24 01:17:15
Exec Total Coverage
Lines: 3 3 100.0%
Functions: 0 0 -%
Branches: 332 664 50.0%

Line Branch Exec Source
1 // Copyright (c) 2021-2024 ChilliBits. All rights reserved.
2
3 #pragma once
4
5 #include <functional>
6
7 // Ignore some warnings in ANTLR generated code
8 #pragma GCC diagnostic push
9 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
10 #include <SpiceVisitor.h>
11 #pragma GCC diagnostic pop
12
13 #include <CompilerPass.h>
14 #include <util/CodeLoc.h>
15 #include <util/GlobalDefinitions.h>
16
17 namespace spice::compiler {
18
19 // Forward declarations
20 class ASTNode;
21 class ConstantNode;
22
23 static constexpr const char *const RESERVED_KEYWORDS[] = {"new", "stash", "pick", "sync", "class"};
24 const char *const MEMBER_ACCESS_TOKEN = ".";
25 const char *const SCOPE_ACCESS_TOKEN = "::";
26
27 class ASTBuilder final : CompilerPass, public SpiceVisitor {
28 private:
29 // Private type defs
30 using TerminalNode = antlr4::tree::TerminalNode;
31 using ParserRuleContext = antlr4::ParserRuleContext;
32 template <typename T> using NumericParserCallback = std::function<T(const std::string &, short, bool)>;
33
34 public:
35 // Constructors
36 ASTBuilder(GlobalResourceManager &resourceManager, SourceFile *sourceFile, antlr4::ANTLRInputStream *inputStream);
37
38 // Public methods
39 std::any visitEntry(SpiceParser::EntryContext *ctx) override;
40 std::any visitMainFunctionDef(SpiceParser::MainFunctionDefContext *ctx) override;
41 std::any visitFunctionDef(SpiceParser::FunctionDefContext *ctx) override;
42 std::any visitProcedureDef(SpiceParser::ProcedureDefContext *ctx) override;
43 std::any visitFctName(SpiceParser::FctNameContext *ctx) override;
44 std::any visitGenericTypeDef(SpiceParser::GenericTypeDefContext *ctx) override;
45 std::any visitAliasDef(SpiceParser::AliasDefContext *ctx) override;
46 std::any visitStructDef(SpiceParser::StructDefContext *ctx) override;
47 std::any visitInterfaceDef(SpiceParser::InterfaceDefContext *ctx) override;
48 std::any visitEnumDef(SpiceParser::EnumDefContext *ctx) override;
49 std::any visitGlobalVarDef(SpiceParser::GlobalVarDefContext *ctx) override;
50 std::any visitExtDecl(SpiceParser::ExtDeclContext *ctx) override;
51 std::any visitImportDef(SpiceParser::ImportDefContext *ctx) override;
52 std::any visitUnsafeBlock(SpiceParser::UnsafeBlockContext *ctx) override;
53 std::any visitForLoop(SpiceParser::ForLoopContext *ctx) override;
54 std::any visitForHead(SpiceParser::ForHeadContext *ctx) override;
55 std::any visitForeachLoop(SpiceParser::ForeachLoopContext *ctx) override;
56 std::any visitForeachHead(SpiceParser::ForeachHeadContext *ctx) override;
57 std::any visitWhileLoop(SpiceParser::WhileLoopContext *ctx) override;
58 std::any visitDoWhileLoop(SpiceParser::DoWhileLoopContext *ctx) override;
59 std::any visitIfStmt(SpiceParser::IfStmtContext *ctx) override;
60 std::any visitElseStmt(SpiceParser::ElseStmtContext *ctx) override;
61 std::any visitSwitchStmt(SpiceParser::SwitchStmtContext *ctx) override;
62 std::any visitCaseBranch(SpiceParser::CaseBranchContext *ctx) override;
63 std::any visitDefaultBranch(SpiceParser::DefaultBranchContext *ctx) override;
64 std::any visitAnonymousBlockStmt(SpiceParser::AnonymousBlockStmtContext *ctx) override;
65 std::any visitStmtLst(SpiceParser::StmtLstContext *ctx) override;
66 std::any visitTypeLst(SpiceParser::TypeLstContext *ctx) override;
67 std::any visitTypeAltsLst(SpiceParser::TypeAltsLstContext *ctx) override;
68 std::any visitParamLst(SpiceParser::ParamLstContext *ctx) override;
69 std::any visitArgLst(SpiceParser::ArgLstContext *ctx) override;
70 std::any visitEnumItemLst(SpiceParser::EnumItemLstContext *ctx) override;
71 std::any visitEnumItem(SpiceParser::EnumItemContext *ctx) override;
72 std::any visitField(SpiceParser::FieldContext *ctx) override;
73 std::any visitSignature(SpiceParser::SignatureContext *ctx) override;
74 std::any visitStmt(SpiceParser::StmtContext *ctx) override;
75 std::any visitDeclStmt(SpiceParser::DeclStmtContext *ctx) override;
76 std::any visitExprStmt(SpiceParser::ExprStmtContext *ctx) override;
77 std::any visitSpecifierLst(SpiceParser::SpecifierLstContext *ctx) override;
78 std::any visitSpecifier(SpiceParser::SpecifierContext *ctx) override;
79 std::any visitTopLevelDefAttr(SpiceParser::TopLevelDefAttrContext *ctx) override;
80 std::any visitLambdaAttr(SpiceParser::LambdaAttrContext *ctx) override;
81 std::any visitModAttr(SpiceParser::ModAttrContext *ctx) override;
82 std::any visitAttrLst(SpiceParser::AttrLstContext *ctx) override;
83 std::any visitAttr(SpiceParser::AttrContext *ctx) override;
84 std::any visitCaseConstant(SpiceParser::CaseConstantContext *ctx) override;
85 std::any visitReturnStmt(SpiceParser::ReturnStmtContext *ctx) override;
86 std::any visitBreakStmt(SpiceParser::BreakStmtContext *ctx) override;
87 std::any visitContinueStmt(SpiceParser::ContinueStmtContext *ctx) override;
88 std::any visitFallthroughStmt(SpiceParser::FallthroughStmtContext *ctx) override;
89 std::any visitAssertStmt(SpiceParser::AssertStmtContext *ctx) override;
90 std::any visitBuiltinCall(SpiceParser::BuiltinCallContext *ctx) override;
91 std::any visitPrintfCall(SpiceParser::PrintfCallContext *ctx) override;
92 std::any visitSizeOfCall(SpiceParser::SizeOfCallContext *ctx) override;
93 std::any visitAlignOfCall(SpiceParser::AlignOfCallContext *ctx) override;
94 std::any visitLenCall(SpiceParser::LenCallContext *ctx) override;
95 std::any visitPanicCall(SpiceParser::PanicCallContext *ctx) override;
96 std::any visitSysCall(SpiceParser::SysCallContext *ctx) override;
97 std::any visitAssignExpr(SpiceParser::AssignExprContext *ctx) override;
98 std::any visitTernaryExpr(SpiceParser::TernaryExprContext *ctx) override;
99 std::any visitLogicalOrExpr(SpiceParser::LogicalOrExprContext *ctx) override;
100 std::any visitLogicalAndExpr(SpiceParser::LogicalAndExprContext *ctx) override;
101 std::any visitBitwiseOrExpr(SpiceParser::BitwiseOrExprContext *ctx) override;
102 std::any visitBitwiseXorExpr(SpiceParser::BitwiseXorExprContext *ctx) override;
103 std::any visitBitwiseAndExpr(SpiceParser::BitwiseAndExprContext *ctx) override;
104 std::any visitEqualityExpr(SpiceParser::EqualityExprContext *ctx) override;
105 std::any visitRelationalExpr(SpiceParser::RelationalExprContext *ctx) override;
106 std::any visitShiftExpr(SpiceParser::ShiftExprContext *ctx) override;
107 std::any visitAdditiveExpr(SpiceParser::AdditiveExprContext *ctx) override;
108 std::any visitMultiplicativeExpr(SpiceParser::MultiplicativeExprContext *ctx) override;
109 std::any visitCastExpr(SpiceParser::CastExprContext *ctx) override;
110 std::any visitPrefixUnaryExpr(SpiceParser::PrefixUnaryExprContext *ctx) override;
111 std::any visitPostfixUnaryExpr(SpiceParser::PostfixUnaryExprContext *ctx) override;
112 std::any visitAtomicExpr(SpiceParser::AtomicExprContext *ctx) override;
113 std::any visitValue(SpiceParser::ValueContext *ctx) override;
114 std::any visitFctCall(SpiceParser::FctCallContext *ctx) override;
115 std::any visitArrayInitialization(SpiceParser::ArrayInitializationContext *ctx) override;
116 std::any visitStructInstantiation(SpiceParser::StructInstantiationContext *ctx) override;
117 std::any visitLambdaFunc(SpiceParser::LambdaFuncContext *ctx) override;
118 std::any visitLambdaProc(SpiceParser::LambdaProcContext *ctx) override;
119 std::any visitLambdaExpr(SpiceParser::LambdaExprContext *ctx) override;
120 std::any visitConstant(SpiceParser::ConstantContext *ctx) override;
121 std::any visitDataType(SpiceParser::DataTypeContext *ctx) override;
122 std::any visitBaseDataType(SpiceParser::BaseDataTypeContext *ctx) override;
123 std::any visitCustomDataType(SpiceParser::CustomDataTypeContext *ctx) override;
124 std::any visitFunctionDataType(SpiceParser::FunctionDataTypeContext *ctx) override;
125 std::any visitAssignOp(SpiceParser::AssignOpContext *ctx) override;
126 std::any visitOverloadableOp(SpiceParser::OverloadableOpContext *ctx) override;
127
128 private:
129 // Members
130 antlr4::ANTLRInputStream *inputStream;
131 std::stack<ASTNode *> parentStack;
132
133 // Private methods
134 template <typename T> T *createNode(const ParserRuleContext *ctx);
135 template <typename T> T *resumeForExpansion();
136 template <typename T> T *concludeNode(T *node);
137 ALWAYS_INLINE CodeLoc getCodeLoc(const ParserRuleContext *ctx) {
138
83/166
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 11202 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29877 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29878 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 27 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 9 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 138 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 67 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 9994 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 11505 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 10964 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 58466 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 75671 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 59386 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 53050 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 51994 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 49175 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 49160 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 46597 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 43041 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 43014 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 43010 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 42978 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 42864 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 42538 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 42029 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 47294 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 1 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 459 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 33 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 11 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 185 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 674 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 1363 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 608 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 6 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 171 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 98 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 5612 times.
✗ Branch 119 not taken.
✓ Branch 121 taken 28 times.
✗ Branch 122 not taken.
✓ Branch 124 taken 627 times.
✗ Branch 125 not taken.
✓ Branch 127 taken 412 times.
✗ Branch 128 not taken.
✓ Branch 130 taken 16 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 118 times.
✗ Branch 134 not taken.
✓ Branch 136 taken 278 times.
✗ Branch 137 not taken.
✓ Branch 139 taken 22996 times.
✗ Branch 140 not taken.
✓ Branch 142 taken 19651 times.
✗ Branch 143 not taken.
✓ Branch 145 taken 9727 times.
✗ Branch 146 not taken.
✓ Branch 148 taken 12674 times.
✗ Branch 149 not taken.
✓ Branch 151 taken 174 times.
✗ Branch 152 not taken.
✓ Branch 154 taken 1194 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 441 times.
✗ Branch 158 not taken.
✓ Branch 160 taken 41 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 7529 times.
✗ Branch 164 not taken.
✓ Branch 166 taken 4937 times.
✗ Branch 167 not taken.
✓ Branch 169 taken 724 times.
✗ Branch 170 not taken.
✓ Branch 172 taken 4411 times.
✗ Branch 173 not taken.
✓ Branch 175 taken 13740 times.
✗ Branch 176 not taken.
✓ Branch 178 taken 13 times.
✗ Branch 179 not taken.
✓ Branch 181 taken 3 times.
✗ Branch 182 not taken.
✓ Branch 184 taken 28 times.
✗ Branch 185 not taken.
✓ Branch 187 taken 8 times.
✗ Branch 188 not taken.
✓ Branch 190 taken 168 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 2918 times.
✗ Branch 194 not taken.
✓ Branch 196 taken 9 times.
✗ Branch 197 not taken.
✓ Branch 199 taken 398 times.
✗ Branch 200 not taken.
✓ Branch 202 taken 87 times.
✗ Branch 203 not taken.
✓ Branch 205 taken 984 times.
✗ Branch 206 not taken.
✓ Branch 208 taken 1808 times.
✗ Branch 209 not taken.
✓ Branch 211 taken 371 times.
✗ Branch 212 not taken.
✓ Branch 214 taken 703 times.
✗ Branch 215 not taken.
✓ Branch 217 taken 739 times.
✗ Branch 218 not taken.
✓ Branch 220 taken 32 times.
✗ Branch 221 not taken.
✓ Branch 223 taken 724 times.
✗ Branch 224 not taken.
✓ Branch 226 taken 41 times.
✗ Branch 227 not taken.
✓ Branch 229 taken 76 times.
✗ Branch 230 not taken.
✓ Branch 232 taken 548 times.
✗ Branch 233 not taken.
✓ Branch 235 taken 6957 times.
✗ Branch 236 not taken.
✓ Branch 238 taken 2707 times.
✗ Branch 239 not taken.
✓ Branch 241 taken 4250 times.
✗ Branch 242 not taken.
✓ Branch 244 taken 382 times.
✗ Branch 245 not taken.
✓ Branch 247 taken 899 times.
✗ Branch 248 not taken.
1027798 const size_t startIdx = ctx->start->getStartIndex();
139
166/332
✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 11202 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 11202 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 29877 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 29877 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 29878 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 29878 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 27 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 27 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 9 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 9 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 138 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 138 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 67 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 67 times.
✗ Branch 44 not taken.
✓ Branch 45 taken 9994 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 9994 times.
✗ Branch 49 not taken.
✓ Branch 50 taken 11505 times.
✗ Branch 51 not taken.
✓ Branch 53 taken 11505 times.
✗ Branch 54 not taken.
✓ Branch 55 taken 10964 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 10964 times.
✗ Branch 59 not taken.
✓ Branch 60 taken 58466 times.
✗ Branch 61 not taken.
✓ Branch 63 taken 58466 times.
✗ Branch 64 not taken.
✓ Branch 65 taken 75671 times.
✗ Branch 66 not taken.
✓ Branch 68 taken 75671 times.
✗ Branch 69 not taken.
✓ Branch 70 taken 59386 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 59386 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 53050 times.
✗ Branch 76 not taken.
✓ Branch 78 taken 53050 times.
✗ Branch 79 not taken.
✓ Branch 80 taken 51994 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 51994 times.
✗ Branch 84 not taken.
✓ Branch 85 taken 49175 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 49175 times.
✗ Branch 89 not taken.
✓ Branch 90 taken 49160 times.
✗ Branch 91 not taken.
✓ Branch 93 taken 49160 times.
✗ Branch 94 not taken.
✓ Branch 95 taken 46597 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 46597 times.
✗ Branch 99 not taken.
✓ Branch 100 taken 43041 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 43041 times.
✗ Branch 104 not taken.
✓ Branch 105 taken 43014 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 43014 times.
✗ Branch 109 not taken.
✓ Branch 110 taken 43010 times.
✗ Branch 111 not taken.
✓ Branch 113 taken 43010 times.
✗ Branch 114 not taken.
✓ Branch 115 taken 42978 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 42978 times.
✗ Branch 119 not taken.
✓ Branch 120 taken 42864 times.
✗ Branch 121 not taken.
✓ Branch 123 taken 42864 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 42538 times.
✗ Branch 126 not taken.
✓ Branch 128 taken 42538 times.
✗ Branch 129 not taken.
✓ Branch 130 taken 42029 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 42029 times.
✗ Branch 134 not taken.
✓ Branch 135 taken 47294 times.
✗ Branch 136 not taken.
✓ Branch 138 taken 47294 times.
✗ Branch 139 not taken.
✓ Branch 140 taken 1 times.
✗ Branch 141 not taken.
✓ Branch 143 taken 1 times.
✗ Branch 144 not taken.
✓ Branch 145 taken 459 times.
✗ Branch 146 not taken.
✓ Branch 148 taken 459 times.
✗ Branch 149 not taken.
✓ Branch 150 taken 33 times.
✗ Branch 151 not taken.
✓ Branch 153 taken 33 times.
✗ Branch 154 not taken.
✓ Branch 155 taken 11 times.
✗ Branch 156 not taken.
✓ Branch 158 taken 11 times.
✗ Branch 159 not taken.
✓ Branch 160 taken 185 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 185 times.
✗ Branch 164 not taken.
✓ Branch 165 taken 674 times.
✗ Branch 166 not taken.
✓ Branch 168 taken 674 times.
✗ Branch 169 not taken.
✓ Branch 170 taken 1363 times.
✗ Branch 171 not taken.
✓ Branch 173 taken 1363 times.
✗ Branch 174 not taken.
✓ Branch 175 taken 608 times.
✗ Branch 176 not taken.
✓ Branch 178 taken 608 times.
✗ Branch 179 not taken.
✓ Branch 180 taken 6 times.
✗ Branch 181 not taken.
✓ Branch 183 taken 6 times.
✗ Branch 184 not taken.
✓ Branch 185 taken 171 times.
✗ Branch 186 not taken.
✓ Branch 188 taken 171 times.
✗ Branch 189 not taken.
✓ Branch 190 taken 98 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 98 times.
✗ Branch 194 not taken.
✓ Branch 195 taken 5612 times.
✗ Branch 196 not taken.
✓ Branch 198 taken 5612 times.
✗ Branch 199 not taken.
✓ Branch 200 taken 28 times.
✗ Branch 201 not taken.
✓ Branch 203 taken 28 times.
✗ Branch 204 not taken.
✓ Branch 205 taken 627 times.
✗ Branch 206 not taken.
✓ Branch 208 taken 627 times.
✗ Branch 209 not taken.
✓ Branch 210 taken 412 times.
✗ Branch 211 not taken.
✓ Branch 213 taken 412 times.
✗ Branch 214 not taken.
✓ Branch 215 taken 16 times.
✗ Branch 216 not taken.
✓ Branch 218 taken 16 times.
✗ Branch 219 not taken.
✓ Branch 220 taken 118 times.
✗ Branch 221 not taken.
✓ Branch 223 taken 118 times.
✗ Branch 224 not taken.
✓ Branch 225 taken 278 times.
✗ Branch 226 not taken.
✓ Branch 228 taken 278 times.
✗ Branch 229 not taken.
✓ Branch 230 taken 22996 times.
✗ Branch 231 not taken.
✓ Branch 233 taken 22996 times.
✗ Branch 234 not taken.
✓ Branch 235 taken 19651 times.
✗ Branch 236 not taken.
✓ Branch 238 taken 19651 times.
✗ Branch 239 not taken.
✓ Branch 240 taken 9727 times.
✗ Branch 241 not taken.
✓ Branch 243 taken 9727 times.
✗ Branch 244 not taken.
✓ Branch 245 taken 12674 times.
✗ Branch 246 not taken.
✓ Branch 248 taken 12674 times.
✗ Branch 249 not taken.
✓ Branch 250 taken 174 times.
✗ Branch 251 not taken.
✓ Branch 253 taken 174 times.
✗ Branch 254 not taken.
✓ Branch 255 taken 1194 times.
✗ Branch 256 not taken.
✓ Branch 258 taken 1194 times.
✗ Branch 259 not taken.
✓ Branch 260 taken 441 times.
✗ Branch 261 not taken.
✓ Branch 263 taken 441 times.
✗ Branch 264 not taken.
✓ Branch 265 taken 41 times.
✗ Branch 266 not taken.
✓ Branch 268 taken 41 times.
✗ Branch 269 not taken.
✓ Branch 270 taken 7529 times.
✗ Branch 271 not taken.
✓ Branch 273 taken 7529 times.
✗ Branch 274 not taken.
✓ Branch 275 taken 4937 times.
✗ Branch 276 not taken.
✓ Branch 278 taken 4937 times.
✗ Branch 279 not taken.
✓ Branch 280 taken 724 times.
✗ Branch 281 not taken.
✓ Branch 283 taken 724 times.
✗ Branch 284 not taken.
✓ Branch 285 taken 4411 times.
✗ Branch 286 not taken.
✓ Branch 288 taken 4411 times.
✗ Branch 289 not taken.
✓ Branch 290 taken 13740 times.
✗ Branch 291 not taken.
✓ Branch 293 taken 13740 times.
✗ Branch 294 not taken.
✓ Branch 295 taken 13 times.
✗ Branch 296 not taken.
✓ Branch 298 taken 13 times.
✗ Branch 299 not taken.
✓ Branch 300 taken 3 times.
✗ Branch 301 not taken.
✓ Branch 303 taken 3 times.
✗ Branch 304 not taken.
✓ Branch 305 taken 28 times.
✗ Branch 306 not taken.
✓ Branch 308 taken 28 times.
✗ Branch 309 not taken.
✓ Branch 310 taken 8 times.
✗ Branch 311 not taken.
✓ Branch 313 taken 8 times.
✗ Branch 314 not taken.
✓ Branch 315 taken 168 times.
✗ Branch 316 not taken.
✓ Branch 318 taken 168 times.
✗ Branch 319 not taken.
✓ Branch 320 taken 2918 times.
✗ Branch 321 not taken.
✓ Branch 323 taken 2918 times.
✗ Branch 324 not taken.
✓ Branch 325 taken 9 times.
✗ Branch 326 not taken.
✓ Branch 328 taken 9 times.
✗ Branch 329 not taken.
✓ Branch 330 taken 398 times.
✗ Branch 331 not taken.
✓ Branch 333 taken 398 times.
✗ Branch 334 not taken.
✓ Branch 335 taken 87 times.
✗ Branch 336 not taken.
✓ Branch 338 taken 87 times.
✗ Branch 339 not taken.
✓ Branch 340 taken 984 times.
✗ Branch 341 not taken.
✓ Branch 343 taken 984 times.
✗ Branch 344 not taken.
✓ Branch 345 taken 1808 times.
✗ Branch 346 not taken.
✓ Branch 348 taken 1808 times.
✗ Branch 349 not taken.
✓ Branch 350 taken 371 times.
✗ Branch 351 not taken.
✓ Branch 353 taken 371 times.
✗ Branch 354 not taken.
✓ Branch 355 taken 703 times.
✗ Branch 356 not taken.
✓ Branch 358 taken 703 times.
✗ Branch 359 not taken.
✓ Branch 360 taken 739 times.
✗ Branch 361 not taken.
✓ Branch 363 taken 739 times.
✗ Branch 364 not taken.
✓ Branch 365 taken 32 times.
✗ Branch 366 not taken.
✓ Branch 368 taken 32 times.
✗ Branch 369 not taken.
✓ Branch 370 taken 724 times.
✗ Branch 371 not taken.
✓ Branch 373 taken 724 times.
✗ Branch 374 not taken.
✓ Branch 375 taken 41 times.
✗ Branch 376 not taken.
✓ Branch 378 taken 41 times.
✗ Branch 379 not taken.
✓ Branch 380 taken 76 times.
✗ Branch 381 not taken.
✓ Branch 383 taken 76 times.
✗ Branch 384 not taken.
✓ Branch 385 taken 548 times.
✗ Branch 386 not taken.
✓ Branch 388 taken 548 times.
✗ Branch 389 not taken.
✓ Branch 390 taken 6957 times.
✗ Branch 391 not taken.
✓ Branch 393 taken 6957 times.
✗ Branch 394 not taken.
✓ Branch 395 taken 2707 times.
✗ Branch 396 not taken.
✓ Branch 398 taken 2707 times.
✗ Branch 399 not taken.
✓ Branch 400 taken 4250 times.
✗ Branch 401 not taken.
✓ Branch 403 taken 4250 times.
✗ Branch 404 not taken.
✓ Branch 405 taken 382 times.
✗ Branch 406 not taken.
✓ Branch 408 taken 382 times.
✗ Branch 409 not taken.
✓ Branch 410 taken 899 times.
✗ Branch 411 not taken.
✓ Branch 413 taken 899 times.
✗ Branch 414 not taken.
1027798 const size_t stopIdx = ctx->stop ? ctx->stop->getStopIndex() : startIdx;
140
83/166
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 11202 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29877 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29878 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 27 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 9 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 138 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 67 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 9994 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 11505 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 10964 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 58466 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 75671 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 59386 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 53050 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 51994 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 49175 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 49160 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 46597 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 43041 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 43014 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 43010 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 42978 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 42864 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 42538 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 42029 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 47294 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 1 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 459 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 33 times.
✗ Branch 92 not taken.
✓ Branch 94 taken 11 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 185 times.
✗ Branch 98 not taken.
✓ Branch 100 taken 674 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 1363 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 608 times.
✗ Branch 107 not taken.
✓ Branch 109 taken 6 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 171 times.
✗ Branch 113 not taken.
✓ Branch 115 taken 98 times.
✗ Branch 116 not taken.
✓ Branch 118 taken 5612 times.
✗ Branch 119 not taken.
✓ Branch 121 taken 28 times.
✗ Branch 122 not taken.
✓ Branch 124 taken 627 times.
✗ Branch 125 not taken.
✓ Branch 127 taken 412 times.
✗ Branch 128 not taken.
✓ Branch 130 taken 16 times.
✗ Branch 131 not taken.
✓ Branch 133 taken 118 times.
✗ Branch 134 not taken.
✓ Branch 136 taken 278 times.
✗ Branch 137 not taken.
✓ Branch 139 taken 22996 times.
✗ Branch 140 not taken.
✓ Branch 142 taken 19651 times.
✗ Branch 143 not taken.
✓ Branch 145 taken 9727 times.
✗ Branch 146 not taken.
✓ Branch 148 taken 12674 times.
✗ Branch 149 not taken.
✓ Branch 151 taken 174 times.
✗ Branch 152 not taken.
✓ Branch 154 taken 1194 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 441 times.
✗ Branch 158 not taken.
✓ Branch 160 taken 41 times.
✗ Branch 161 not taken.
✓ Branch 163 taken 7529 times.
✗ Branch 164 not taken.
✓ Branch 166 taken 4937 times.
✗ Branch 167 not taken.
✓ Branch 169 taken 724 times.
✗ Branch 170 not taken.
✓ Branch 172 taken 4411 times.
✗ Branch 173 not taken.
✓ Branch 175 taken 13740 times.
✗ Branch 176 not taken.
✓ Branch 178 taken 13 times.
✗ Branch 179 not taken.
✓ Branch 181 taken 3 times.
✗ Branch 182 not taken.
✓ Branch 184 taken 28 times.
✗ Branch 185 not taken.
✓ Branch 187 taken 8 times.
✗ Branch 188 not taken.
✓ Branch 190 taken 168 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 2918 times.
✗ Branch 194 not taken.
✓ Branch 196 taken 9 times.
✗ Branch 197 not taken.
✓ Branch 199 taken 398 times.
✗ Branch 200 not taken.
✓ Branch 202 taken 87 times.
✗ Branch 203 not taken.
✓ Branch 205 taken 984 times.
✗ Branch 206 not taken.
✓ Branch 208 taken 1808 times.
✗ Branch 209 not taken.
✓ Branch 211 taken 371 times.
✗ Branch 212 not taken.
✓ Branch 214 taken 703 times.
✗ Branch 215 not taken.
✓ Branch 217 taken 739 times.
✗ Branch 218 not taken.
✓ Branch 220 taken 32 times.
✗ Branch 221 not taken.
✓ Branch 223 taken 724 times.
✗ Branch 224 not taken.
✓ Branch 226 taken 41 times.
✗ Branch 227 not taken.
✓ Branch 229 taken 76 times.
✗ Branch 230 not taken.
✓ Branch 232 taken 548 times.
✗ Branch 233 not taken.
✓ Branch 235 taken 6957 times.
✗ Branch 236 not taken.
✓ Branch 238 taken 2707 times.
✗ Branch 239 not taken.
✓ Branch 241 taken 4250 times.
✗ Branch 242 not taken.
✓ Branch 244 taken 382 times.
✗ Branch 245 not taken.
✓ Branch 247 taken 899 times.
✗ Branch 248 not taken.
1027798 return {ctx->start, startIdx, stopIdx, sourceFile};
141 }
142 int32_t parseInt(TerminalNode *terminal);
143 int16_t parseShort(TerminalNode *terminal);
144 int64_t parseLong(TerminalNode *terminal);
145 int8_t parseChar(TerminalNode *terminal) const;
146 static std::string parseString(std::string input);
147 template <typename T> T parseNumeric(TerminalNode *terminal, const NumericParserCallback<T> &cb);
148 static void replaceEscapeChars(std::string &input);
149 std::string getIdentifier(TerminalNode *terminal) const;
150 };
151
152 } // namespace spice::compiler
153