C0 code coverage information

Generated on Mon Nov 03 16:07:05 +0900 2008 with rcov 0.8.1.2


Code reported as executed by Ruby looks like
    this... and this: this line is also marked as
    covered. Lines considered as run by rcov, but
    not reported by Ruby, look like this, and
    this: these lines were inferred by rcov (using simple heuristics).
    Finally, here's a line marked as not
    executed. 
Name Total lines Lines of code Total coverage Code coverage
lib/twowaysql/parser.rb 535 431
98.9%  
99.1%  
 1 #
     2 # DO NOT MODIFY!!!!
     3 # This file is
    automatically generated by racc 1.4.5  4 # from racc grammer file
    "lib/twowaysql/parser.y".  5 #  6
     7 require 'racc/parser'
     8  9  10 module TwoWaySQL  11  12
    class Parser < Racc::Parser  13  14
    module_eval <<'..end lib/twowaysql/parser.y modeval..id64138765db',
    'lib/twowaysql/parser.y', 134  15 
    16 require 'strscan'  17
     18 def
    initialize(opts={})  19
    opts = {  20 :debug
    => false,  21
    :preserve_space => true,  22 :preserve_comment => false  23 }.merge(opts)  24 @yydebug = opts[:debug]
     25 @preserve_space =
    opts[:preserve_space] 
    26 @preserve_comment = opts[:preserve_comment]  27 @num_questions = 0  28 end  29  30 
    31 PAREN_EXAMPLE = '\([^\)]+\)'  32 BEGIN_BIND_VARIABLE = '(\/|\#)\*([^\*]+)\*\1'
     33
    BIND_VARIABLE_PATTERN = /\A#{BEGIN_BIND_VARIABLE}\s*/  34 PAREN_BIND_VARIABLE_PATTERN =
    /\A#{BEGIN_BIND_VARIABLE}\s*#{PAREN_EXAMPLE}/  35 EMBED_VARIABLE_PATTERN =
    /\A(\/|\#)\*\$([^\*]+)\*\1\s*/  36 
    37 CONDITIONAL_PATTERN = /\A(\/|\#)\*(IF)\s+([^\*]+)\s*\*\1/  38 BEGIN_END_PATTERN =
    /\A(\/|\#)\*(BEGIN|END)\s*\*\1/  39 STRING_LITERAL_PATTERN = /\A(\'(?:[^\']+|\'\')*\')/ ##
    quoted string  40
    SPLIT_TOKEN_PATTERN = /\A(\S+?)(?=\s*(?:(?:\/|\#)\*|-{2,}|\(|\)|\,))/ ##
    stop on delimiters --,/*,#*,',',(,)  41 LITERAL_PATTERN = /\A([^;\s]+)/  42 SPACES_PATTERN = /\A(\s+)/
     43 QUESTION_PATTERN =
    /\A\?/  44 COMMA_PATTERN
    = /\A\,/  45
    LPAREN_PATTERN = /\A\(/ 
    46 RPAREN_PATTERN = /\A\)/  47 ACTUAL_COMMENT_PATTERN =
    /\A(\/|\#)\*(\s{1,}(?:.*?))\*\1/m ## start with spaces  48 SEMICOLON_AT_INPUT_END_PATTERN =
    /\A\;\s*\Z/  49
    UNMATCHED_COMMENT_START_PATTERN = /\A(?:(?:\/|\#)\*)/  50  51 #TODO: remove trailing spaces for S2Dao compatibility,
    but this spec sometimes causes SQL bugs...  52 ELSE_PATTERN = /\A\-{2,}\s*ELSE\s*/  53 AND_PATTERN = /\A(\ *AND)\b/i
     54 OR_PATTERN = /\A(\
    *OR)\b/i  55
     56  57 def parse( io )  58 @q = []  59 io.each_line(nil) do |whole|
     60 @s =
    StringScanner.new(whole)  61 end  62 scan_str  63 
    64 # @q.push [ false, nil ]  65 @q.push [ false, [@s.pos, nil] ]  66  67 ## call racc's private parse method  68 do_parse  69 end  70  71 
    72 ## called by racc  73
    def next_token  74
    @q.shift  75 end
     76  77  78 def scan_str  79 until @s.eos? do  80 case  81 when @s.scan(AND_PATTERN)  82 @q.push [ :AND, [@s.pos, @s[1]] ]
     83 when
    @s.scan(OR_PATTERN)  84
    @q.push [ :OR, [@s.pos, @s[1]] ]  85 when @s.scan(SPACES_PATTERN)  86 @q.push [ :SPACES, [@s.pos,
    @s[1]] ]  87 when
    @s.scan(QUESTION_PATTERN)  88 @q.push [ :QUESTION, [@s.pos, nil] ]  89 when @s.scan(COMMA_PATTERN)
     90 @q.push [ :COMMA,
    [@s.pos, ','] ]  91 when
    @s.scan(LPAREN_PATTERN) 
    92 @q.push [ :LPAREN, [@s.pos, '('] ]  93 when @s.scan(RPAREN_PATTERN)  94 @q.push [ :RPAREN, [@s.pos, ')']
    ]  95 when
    @s.scan(ELSE_PATTERN) 
    96 @q.push [ :ELSE, [@s.pos, nil] ]  97 when @s.scan(ACTUAL_COMMENT_PATTERN)  98 @q.push [ :ACTUAL_COMMENT,
    [@s.pos, @s[1], @s[2]] ] if @preserve_comment  99 when @s.scan(BEGIN_END_PATTERN)
    100 @q.push [
    @s[2].intern, [@s.pos, nil] ] 101 when @s.scan(CONDITIONAL_PATTERN) 102 @q.push [ @s[2].intern, [@s.pos,
    @s[3]] ] 103 when
    @s.scan(EMBED_VARIABLE_PATTERN) 104 @q.push [ :EMBED_VARIABLE, [@s.pos, @s[2]] ]
    105 when
    @s.scan(PAREN_BIND_VARIABLE_PATTERN) 106 @q.push [ :PAREN_BIND_VARIABLE, [@s.pos, @s[2]] ]
    107 when
    @s.scan(BIND_VARIABLE_PATTERN) 108 @q.push [ :BIND_VARIABLE, [@s.pos, @s[2]] ]
    109 when
    @s.scan(STRING_LITERAL_PATTERN) 110 @q.push [ :STRING_LITERAL, [@s.pos, @s[1]] ]
    111 when
    @s.scan(SPLIT_TOKEN_PATTERN) 112 @q.push [ :IDENT, [@s.pos, @s[1]] ] 113 when
    @s.scan(UNMATCHED_COMMENT_START_PATTERN) ## unmatched comment start,
    '/*','#*' 114 raise
    Racc::ParseError, "unmatched comment. line:[#{line_no(@s.pos)}],
    str:[#{@s.rest}]" 115 when @s.scan(LITERAL_PATTERN) ## other string token
    116 @q.push [ :IDENT,
    [@s.pos, @s[1]] ] 117
    when @s.scan(SEMICOLON_AT_INPUT_END_PATTERN) 118 #drop semicolon at input end
    119 else 120 raise Racc::ParseError,
    "syntax error at or near line:[#{line_no(@s.pos)}],
    str:[#{@s.rest}]" 121 end 122 end 123 end 124 125 126 ## override racc's default on_error method
    127 def on_error(t, v,
    vstack) 128 ## cursor
    in value-stack is an array of two items, 129 ## that have position value as 0th item. like [731,
    "ctx[:limit] "] 130 cursor = vstack.find do |tokens| 131 tokens.size == 2 and
    tokens[0].kind_of?(Fixnum) 132 end 133 pos = cursor[0] 134 line = line_no(pos) 135 rest = @s.string[pos .. -1] 136 raise Racc::ParseError,
    "syntax error at or near line:[#{line}], str:[#{rest}]"
    137 end 138 139 140 def line_no(pos) 141 lines = 0 142 scanned = @s.string[0..(pos)]
    143 scanned.each_line {
    lines += 1 } 144 lines
    145 end 146 ..end lib/twowaysql/parser.y
    modeval..id64138765db 147 148 ##### racc 1.4.5 generates ### 149 150 racc_reduce_table = [ 151 0, 0, :racc_error, 152 1, 20, :_reduce_1, 153 0, 21, :_reduce_2, 154 2, 21, :_reduce_3, 155 1, 22, :_reduce_none,
    156 1, 22,
    :_reduce_none, 157 1,
    22, :_reduce_none, 158
    3, 25, :_reduce_7, 159
    4, 24, :_reduce_8, 160
    2, 27, :_reduce_9, 161
    0, 27, :_reduce_10, 162
    1, 26, :_reduce_none, 163 1, 26, :_reduce_none, 164 1, 26, :_reduce_none,
    165 2, 28, :_reduce_14,
    166 2, 29, :_reduce_15,
    167 1, 23, :_reduce_16,
    168 1, 23, :_reduce_17,
    169 1, 23, :_reduce_18,
    170 1, 23, :_reduce_19,
    171 1, 23, :_reduce_20,
    172 1, 23, :_reduce_21,
    173 1, 23, :_reduce_22,
    174 1, 23, :_reduce_23,
    175 1, 23, :_reduce_24,
    176 1, 23, :_reduce_25,
    177 1, 23,
    :_reduce_none, 178 1,
    23, :_reduce_none, 179
    2, 30, :_reduce_28, 180
    3, 30, :_reduce_29, 181
    2, 30, :_reduce_30, 182
    3, 30, :_reduce_31, 183
    1, 30, :_reduce_32, 184
    2, 31, :_reduce_33, 185
    3, 31, :_reduce_34 ] 186 187 racc_reduce_n = 35 188 189 racc_shift_n = 48 190 191 racc_action_table = [ 192 9, 36, 14, 37, 17, 19, 21, 23,
    24, 4, 193 6, 8, 11,
    13, 15, 16, 18, 9, 39, 14, 194 45, 17, 19, 21, 23, 24, 4, 6, 8, 11, 195 13, 15, 16, 18, 9, 47, 14, 25,
    17, 19, 196 21, 23, 24,
    4, 6, 8, 11, 13, 15, 16, 197 18, 9, 38, 14, 3, 17, 19, 21, 23, 24, 198 4, 6, 8, 11, 13, 15, 16, 18, 9,
    nil, 199 14, nil, 17,
    19, 21, 23, 24, 4, 6, 8, 200 11, 13, 15, 16, 18, 33, 34, 35, 28, 30, 201 28, 30, 43, 44 ] 202 203 racc_action_check = [ 204 42, 18, 42, 18, 42, 42, 42, 42,
    42, 42, 205 42, 42, 42,
    42, 42, 42, 42, 2, 27, 2, 206 37, 2, 2, 2, 2, 2, 2, 2, 2, 2, 207 2, 2, 2, 2, 41, 40, 41, 3, 41,
    41, 208 41, 41, 41, 41,
    41, 41, 41, 41, 41, 41, 209 41, 26, 26, 26, 1, 26, 26, 26, 26, 26, 210 26, 26, 26, 26, 26, 26, 26, 26,
    32, nil, 211 32, nil,
    32, 32, 32, 32, 32, 32, 32, 32, 212 32, 32, 32, 32, 32, 15, 15, 15, 39, 39, 213 14, 14, 35, 35 ] 214 215 racc_action_pointer = [ 216 nil, 54, 15, 37, nil, nil, nil,
    nil, nil, nil, 217 nil,
    nil, nil, nil, 84, 77, nil, nil, -7, nil, 218 nil, nil, nil, nil, nil, nil, 49, 13, nil, nil,
    219 nil, nil, 66, nil,
    nil, 84, nil, 12, nil, 82, 220 32, 32, -2, nil, nil, nil, nil, nil ] 221 222 racc_action_default = [ 223 -2, -35, -1, -35, -21, -3, -22,
    -4, -23, -2, 224 -5,
    -24, -6, -25, -2, -35, -32, -18, -35, -19, 225 -26, -16, -27, -17, -20, 48, -35, -10, -2, -11,
    226 -2, -12, -13, -30,
    -28, -35, -33, -35, -7, -2, 227 -35, -14, -15, -31, -29, -34, -9, -8 ] 228 229 racc_goto_table = [ 230 2, 27, 1, 40, nil, nil, nil, nil, nil, 26,
    231 nil, nil, nil, nil,
    nil, nil, nil, nil, nil, nil, 232 nil, nil, nil, nil, nil, nil, 46, nil, 41, nil,
    233 42 ] 234 235 racc_goto_check = [ 236 2, 7, 1, 8, nil, nil, nil, nil, nil, 2, 237 nil, nil, nil, nil, nil, nil,
    nil, nil, nil, nil, 238
    nil, nil, nil, nil, nil, nil, 7, nil, 2, nil, 239 2 ] 240 241 racc_goto_pointer = [ 242 nil, 2, 0, nil, nil, nil, nil,
    -13, -24, nil, 243 nil,
    nil, nil ] 244
    245 racc_goto_default = [
    246 nil, nil, 32, 5, 7,
    10, 12, nil, nil, 29, 247 31, 20, 22 ] 248 249 racc_token_table = { 250 false => 0, 251 Object.new => 1, 252 :BEGIN => 2, 253 :END => 3, 254 :IF => 4, 255 :ELSE => 5, 256 :AND => 6, 257 :OR => 7, 258 :IDENT => 8, 259 :STRING_LITERAL => 9,
    260 :SPACES => 10,
    261 :COMMA => 11,
    262 :LPAREN => 12,
    263 :RPAREN => 13,
    264 :QUESTION => 14,
    265 :ACTUAL_COMMENT
    => 15, 266
    :BIND_VARIABLE => 16, 267 :PAREN_BIND_VARIABLE => 17, 268 :EMBED_VARIABLE => 18 }
    269 270 racc_use_result_var = true
    271 272 racc_nt_base = 19 273 274 Racc_arg = [ 275 racc_action_table, 276 racc_action_check, 277 racc_action_default, 278 racc_action_pointer,
    279 racc_goto_table,
    280 racc_goto_check,
    281 racc_goto_default,
    282 racc_goto_pointer,
    283 racc_nt_base,
    284 racc_reduce_table,
    285 racc_token_table,
    286 racc_shift_n,
    287 racc_reduce_n,
    288 racc_use_result_var
    ] 289 290 Racc_token_to_s_table = [
    291 '$end',
    292 'error',
    293 'BEGIN',
    294 'END', 295 'IF', 296 'ELSE', 297 'AND', 298 'OR', 299 'IDENT', 300 'STRING_LITERAL', 301 'SPACES', 302 'COMMA', 303 'LPAREN', 304 'RPAREN', 305 'QUESTION', 306 'ACTUAL_COMMENT', 307 'BIND_VARIABLE', 308 'PAREN_BIND_VARIABLE',
    309 'EMBED_VARIABLE',
    310 '$start',
    311 'sql', 312 'stmt_list', 313 'stmt', 314 'primary', 315 'if_stmt', 316 'begin_stmt', 317 'sub_stmt', 318 'else_stmt', 319 'and_stmt', 320 'or_stmt', 321 'bind_var', 322 'embed_var'] 323 324 Racc_debug_parser = false 325 326 ##### racc system variables end
    ##### 327 328 # reduce 0 omitted 329 330 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    8 331 def _reduce_1(
    val, _values, result ) 332 result = RootNode.new( val[0] ) 333 result 334 end 335 .,., 336 337 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    13 338 def _reduce_2(
    val, _values, result ) 339 result = [] 340 result 341 end 342 .,., 343 344 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    17 345 def _reduce_3(
    val, _values, result ) 346 result.push val[1] 347 result 348 end 349 .,., 350 351 # reduce 4 omitted 352 353 # reduce 5 omitted 354 355 # reduce 6 omitted 356 357 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    26 358 def _reduce_7(
    val, _values, result ) 359 result = BeginNode.new( val[1] ) 360 result 361 end 362 .,., 363 364 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    31 365 def _reduce_8(
    val, _values, result ) 366 result = IfNode.new( val[0][1], val[1], val[2] )
    367 result 368 end 369 .,., 370 371 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    36 372 def _reduce_9(
    val, _values, result ) 373 result = val[1] 374 result 375 end 376 .,., 377 378 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    40 379 def _reduce_10(
    val, _values, result ) 380 result = nil 381 result 382 end 383 .,., 384 385 # reduce 11 omitted 386 387 # reduce 12 omitted 388 389 # reduce 13 omitted 390 391 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    49 392 def _reduce_14(
    val, _values, result ) 393 result = SubStatementNode.new( val[0][1], val[1] )
    394 result 395 end 396 .,., 397 398 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    54 399 def _reduce_15(
    val, _values, result ) 400 result = SubStatementNode.new( val[0][1], val[1] )
    401 result 402 end 403 .,., 404 405 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    59 406 def _reduce_16(
    val, _values, result ) 407 result = LiteralNode.new( val[0][1] ) 408 result 409 end 410 .,., 411 412 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    63 413 def _reduce_17(
    val, _values, result ) 414 result = LiteralNode.new( val[0][1] ) 415 result 416 end 417 .,., 418 419 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    67 420 def _reduce_18(
    val, _values, result ) 421 result = LiteralNode.new( val[0][1] ) 422 result 423 end 424 .,., 425 426 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    71 427 def _reduce_19(
    val, _values, result ) 428 result = LiteralNode.new( val[0][1] ) 429 result 430 end 431 .,., 432 433 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    75 434 def _reduce_20(
    val, _values, result ) 435 result = WhiteSpaceNode.new( val[0][1],
    @preserve_space ) 436
    result 437 end
    438 .,., 439 440 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    79 441 def _reduce_21(
    val, _values, result ) 442 result = LiteralNode.new( val[0][1] ) 443 result 444 end 445 .,., 446 447 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    83 448 def _reduce_22(
    val, _values, result ) 449 result = LiteralNode.new( val[0][1] ) 450 result 451 end 452 .,., 453 454 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    87 455 def _reduce_23(
    val, _values, result ) 456 result = LiteralNode.new( val[0][1] ) 457 result 458 end 459 .,., 460 461 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    92 462 def _reduce_24(
    val, _values, result ) 463 @num_questions += 1 464 result = QuestionNode.new( @num_questions )
    465 result 466 end 467 .,., 468 469 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    96 470 def _reduce_25(
    val, _values, result ) 471 result = ActualCommentNode.new( val[0][1] , val[0][2]
    ) 472 result
    473 end 474 .,., 475 476 # reduce 26 omitted 477 478 # reduce 27 omitted 479 480 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    103 481 def _reduce_28(
    val, _values, result ) 482 result = BindVariableNode.new( val[0][1] )
    483 result 484 end 485 .,., 486 487 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    107 488 def _reduce_29(
    val, _values, result ) 489 result = BindVariableNode.new( val[0][1] )
    490 result 491 end 492 .,., 493 494 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    111 495 def _reduce_30(
    val, _values, result ) 496 result = BindVariableNode.new( val[0][1] )
    497 result 498 end 499 .,., 500 501 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    115 502 def _reduce_31(
    val, _values, result ) 503 result = BindVariableNode.new( val[0][1] )
    504 result 505 end 506 .,., 507 508 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    119 509 def _reduce_32(
    val, _values, result ) 510 result = ParenBindVariableNode.new( val[0][1] )
    511 result 512 end 513 .,., 514 515 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    124 516 def _reduce_33(
    val, _values, result ) 517 result = EmbedVariableNode.new( val[0][1] )
    518 result 519 end 520 .,., 521 522 module_eval <<'.,.,', 'lib/twowaysql/parser.y',
    128 523 def _reduce_34(
    val, _values, result ) 524 result = EmbedVariableNode.new( val[0][1] )
    525 result 526 end 527 .,., 528 529 def _reduce_none( val, _values, result ) 530 result 531 end 532 533 end # class Parser 534 535 end # module TwoWaySQL
    

Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.

Valid XHTML 1.0! Valid CSS!