Changeset 5b7fcf9f301963803ed8fa27278591f685abf682

Show
Ignore:
Timestamp:
06/23/2008 12:13:26 PM (7 months ago)
Author:
mitchell <mitchell@frost.(none)>
git-committer:
mitchell <mitchell@frost.(none)> 1214248406 -0400
git-parent:

[3c1539eeb1e066cd00cd3114851c02578e77264e]

git-author:
mitchell <mitchell@frost.(none)> 1214248406 -0400
Message:

Fixed another segfault; renamed 'queue' action to 'enqueue'.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PARSER_DOC

    rb354c6b r5b7fcf9  
    221221      defining line_start. 
    222222 
    223       Also for multi-line matches, it may be necessary to use the 'queue' and 
     223      Also for multi-line matches, it may be necessary to use the 'enqueue' and 
    224224      'commit' actions. If it is possible that a multi-line entity will not have 
    225       an ending delimiter (for example a string), use the 'queue' action as soon 
    226       as the start delimitter has been detected, and the 'commit' action as soon 
    227       as the end delimitter has been detected. This will eliminate the potential 
    228       for any counting errors. 
     225      an ending delimiter (for example a string), use the 'enqueue' action as 
     226      soon as the start delimitter has been detected, and the 'commit' action as 
     227      soon as the end delimitter has been detected. This will eliminate the 
     228      potential for any counting errors. 
    229229 
    230230    Notes: 
  • ext/ohcount_native/ragel_parser_macros.h

    rb354c6b r5b7fcf9  
    4242void enqueue(const char *lang, const char *entity, int s, int e) { 
    4343  Callback *item = (Callback *) malloc(sizeof(Callback)); 
    44   //assert(item != NULL); // trap malloc errors 
     44  if (!item) printf("Failed to allocate memory for enqueued callback.\n"); 
    4545 
    4646  item->lang = lang; 
     
    6262void free_queue() { 
    6363  Callback *item = callback_list_head; 
    64   while (item != NULL) { 
     64  while (item) { 
    6565    Callback *next = item->next; 
    6666    free(item); 
    6767    item = next; 
    6868  } 
     69  callback_list_head = NULL; 
     70  callback_list_tail = NULL; 
    6971} 
    7072 
     
    175177 */ 
    176178#define std_newline(lang) {\ 
     179  if (inqueue) { dequeue; } \ 
    177180  if (callback && te > line_start) { \ 
    178181    if (line_contains_code) \ 
  • ext/ohcount_native/ragel_parsers/common.rl

    rb354c6b r5b7fcf9  
    2828# common actions 
    2929 
    30 action queue { 
     30action enqueue { 
    3131  inqueue = 1; 
    32   free_queue(); // free the current queue 
     32  if (callback_list_head) free_queue(); // free the current queue 
    3333  callback_list_head = NULL; 
    3434  callback_list_tail = NULL; 
  • ext/ohcount_native/ragel_parsers/ruby.rl

    r3c1539e r5b7fcf9  
    4949  # Can't do that now because using 'when starts_line' fails a Ragel assertion. 
    5050  ruby_block_comment = 
    51     '=begin' @queue @comment ( 
     51    '=begin' @enqueue @comment ( 
    5252      newline %{ entity = INTERNAL_NL; } %ruby_ccallback 
    5353      | 
     
    5959 
    6060  ruby_sq_str = 
    61     '\'' @queue @code ( 
     61    '\'' @enqueue @code ( 
    6262      newline %{ entity = INTERNAL_NL; } %ruby_ccallback 
    6363      | 
     
    6969    )* '\'' @commit @code; 
    7070  ruby_dq_str = 
    71     '"' @queue @code ( 
     71    '"' @enqueue @code ( 
    7272      newline %{ entity = INTERNAL_NL; } %ruby_ccallback 
    7373      | 
     
    8888  # closing char in the literal string below. 
    8989  ruby_lit_str = 
    90     '%' [qQ]? [(\[{] @queue @code ( 
     90    '%' [qQ]? [(\[{] @enqueue @code ( 
    9191      newline %{ entity = INTERNAL_NL; } %ruby_ccallback 
    9292      | 
     
    9898    )* [)\]}] @commit @code; 
    9999  ruby_cmd_str = 
    100     '`' @queue @code ( 
     100    '`' @enqueue @code ( 
    101101      newline %{ entity = INTERNAL_NL; } %ruby_ccallback 
    102102      | 
     
    111111  # See TODO above about literal string detection 
    112112  ruby_lit_other = 
    113     '%' [wrx] [(\[{] @queue @code ( 
     113    '%' [wrx] [(\[{] @enqueue @code ( 
    114114      newline %{ entity = INTERNAL_NL; } %ruby_ccallback 
    115115      |