Branch Coverage

lib/Compiler/Lexer.xs
Criterion Covered Total %
branch 7 126 5.5


line true false branch
38 27 0 Lexer *lexer = new Lexer(filename, verbose);
49 27 0 delete self;
61 8788 35 for (size_t i = 0; i < size; i++) {
88 0 0 if (tokens_size < 0) {
93 0 0 for (int i = 0; i <= tokens_size; i++) {
94 0 0 SV *token_ = (SV *)*av_fetch(tokens_, i, FALSE);
95 0 0 if (sv_isa(token_, "Compiler::Lexer::Token")) {
0 0 if (sv_isa(token_, "Compiler::Lexer::Token")) {
99 0 0 const char *name = SvPVX(get_value(token, "name"));
100 0 0 const char *data = SvPVX(get_value(token, "data"));
101 0 0 int line = SvIVX(get_value(token, "line"));
102 0 0 int has_warnings = SvIVX(get_value(token, "has_warnings"));
103 0 0 Enum::Token::Type::Type type = (Enum::Token::Type::Type)SvIVX(get_value(token, "type"));
104 0 0 Enum::Token::Kind::Kind kind = (Enum::Token::Kind::Kind)SvIVX(get_value(token, "kind"));
115 0 0 Token *tk = new Token(std::string(data), finfo);
0 0 Token *tk = new Token(std::string(data), finfo);
0 0 Token *tk = new Token(std::string(data), finfo);
119 0 0 tks.push_back(tk);
121 0 0 self->grouping(&tks);
122 0 0 self->prepare(&tks);
124 0 0 Token *root = self->parseSyntax(NULL, &tks);
126 0 0 self->parseSpecificStmt(root);
128 0 0 self->setIndent(root, 0);
130 0 0 self->setBlockIDWithDepthFirst(root, &block_id);
131 0 0 Tokens *stmts = self->getTokensBySyntaxLevel(root, (Enum::Parser::Syntax::Type)syntax_level);
132 0 0 AV* ret = new_Array();
0 0 AV* ret = new_Array();
133 0 0 for (size_t i = 0; i < stmts->size(); i++) {
135 0 0 const char *src = stmt->deparse();
137 0 0 HV *hash = (HV*)new_Hash();
0 0 HV *hash = (HV*)new_Hash();
138 0 0 (void)hv_stores(hash, "src", set(new_String(src, len)));
0 0 (void)hv_stores(hash, "src", set(new_String(src, len)));
0 0 (void)hv_stores(hash, "src", set(new_String(src, len)));
139 0 0 (void)hv_stores(hash, "token_num", set(new_Int(stmt->total_token_num)));
0 0 (void)hv_stores(hash, "token_num", set(new_Int(stmt->total_token_num)));
0 0 (void)hv_stores(hash, "token_num", set(new_Int(stmt->total_token_num)));
140 0 0 (void)hv_stores(hash, "indent", set(new_Int(stmt->finfo.indent)));
0 0 (void)hv_stores(hash, "indent", set(new_Int(stmt->finfo.indent)));
0 0 (void)hv_stores(hash, "indent", set(new_Int(stmt->finfo.indent)));
141 0 0 (void)hv_stores(hash, "block_id", set(new_Int(stmt->finfo.block_id)));
0 0 (void)hv_stores(hash, "block_id", set(new_Int(stmt->finfo.block_id)));
0 0 (void)hv_stores(hash, "block_id", set(new_Int(stmt->finfo.block_id)));
142 0 0 (void)hv_stores(hash, "start_line", set(new_Int(stmt->finfo.start_line_num)));
0 0 (void)hv_stores(hash, "start_line", set(new_Int(stmt->finfo.start_line_num)));
0 0 (void)hv_stores(hash, "start_line", set(new_Int(stmt->finfo.start_line_num)));
143 0 0 (void)hv_stores(hash, "end_line", set(new_Int(stmt->finfo.end_line_num)));
0 0 (void)hv_stores(hash, "end_line", set(new_Int(stmt->finfo.end_line_num)));
0 0 (void)hv_stores(hash, "end_line", set(new_Int(stmt->finfo.end_line_num)));
144 0 0 (void)hv_stores(hash, "has_warnings", set(new_Int(stmt->info.has_warnings)));
0 0 (void)hv_stores(hash, "has_warnings", set(new_Int(stmt->info.has_warnings)));
0 0 (void)hv_stores(hash, "has_warnings", set(new_Int(stmt->info.has_warnings)));
145 0 0 av_push(ret, set(new_Ref(hash)));
0 0 av_push(ret, set(new_Ref(hash)));
0 0 av_push(ret, set(new_Ref(hash)));
164 26 12 for (size_t i = 0; i < modules->size(); i++) {
169 26 0 size_t module_args_len = (module_args) ? strlen(module_args) : 0;
188 0 0 Tokens *tokens = lexer.tokenize((char *)script);
189 0 0 lexer.grouping(tokens);
190 0 0 lexer.prepare(tokens);
191 0 0 Token *root = lexer.parseSyntax(NULL, tokens);
192 0 0 const char *src = root->deparse();
195 0 0 RETVAL = newSVpv(src, len);