Logo Search packages:      
Sourcecode: uncrustify version File versions

chunk_t* pawn_check_vsemicolon ( chunk_t pc  ) 

We are in a virtual brace and hit a newline. If this should end the vbrace, then insert a VSEMICOLON and return that.

Parameters:
pc The newline (CT_NEWLINE)
Returns:
Either the newline or the newly inserted virtual semicolon

Grab the item before the newline Don't do anything if:

  • the only thing previous is the V-Brace open
  • in a preprocessor
  • level > (vb_open->level + 1) -- ie, in () or []
  • it is something that needs a continuation + arith, assign, bool, comma, compare

Definition at line 437 of file lang_pawn.cpp.

References chunk_get_prev_ncnl(), chunk_get_prev_type(), chunk_t::flags, chunk_t::len, chunk_t::level, chunk_t::orig_line, pawn_continued(), chunk_t::str, and chunk_t::type.

Referenced by brace_cleanup().

{
   chunk_t *vb_open;
   chunk_t *prev;

   /* Grab the open VBrace */
   vb_open = chunk_get_prev_type(pc, CT_VBRACE_OPEN, -1);

   /**
    * Grab the item before the newline
    * Don't do anything if:
    *  - the only thing previous is the V-Brace open
    *  - in a preprocessor
    *  - level > (vb_open->level + 1) -- ie, in () or []
    *  - it is something that needs a continuation
    *    + arith, assign, bool, comma, compare
    */
   prev = chunk_get_prev_ncnl(pc);
   if ((prev == NULL) ||
       (prev == vb_open) ||
       ((prev->flags & PCF_IN_PREPROC) != 0) ||
       pawn_continued(prev, vb_open->level + 1))
   {
      if (prev != NULL)
      {
         LOG_FMT(LPVSEMI, "%s:  no  VSEMI on line %d, prev='%.*s' [%s]\n",
                 __func__, prev->orig_line, prev->len, prev->str, get_token_name(prev->type));
      }
      return(pc);
   }

   return(pawn_add_vsemi_after(prev));
}


Generated by  Doxygen 1.6.0   Back to index