You are here

function coder_preprocessor_inline_comment in Coder 6.2

Same name and namespace in other branches
  1. 5.2 scripts/coder_format/coder_format.inc \coder_preprocessor_inline_comment()
  2. 5 scripts/coder_format/coder_format.inc \coder_preprocessor_inline_comment()
  3. 6 scripts/coder_format/coder_format.inc \coder_preprocessor_inline_comment()
  4. 7.2 scripts/coder_format/coder_format.inc \coder_preprocessor_inline_comment()
  5. 7 scripts/coder_format/coder_format.inc \coder_preprocessor_inline_comment()

Related topics

File

scripts/coder_format/coder_format.inc, line 1191
Coder format helper functions.

Code

function coder_preprocessor_inline_comment() {
  return array(
    '#title' => 'Move inline comments above remarked line.',
    '#weight' => 2,
    '#search' => '@
      ^([\\040\\t]*)  # match spaces or tabs only.
      (?!case)      # do not match case statements.
      (\\S.+?        # do not match lines containing only a comment.
        [;,{]       # match the TRICKY lines only.
      )
      [\\040\\t]*     # match spaces or tabs only.
      (?!:)         # do not match URL protocols.
      //\\s*         # match inline comment token.
      ([^;\\$]+?)$   # fetch comment, but do not match CVS keyword Id, nested comments, and comment tokens in quotes (f.e. "W3C//DTD").
      @mx',
    '#replace' => "\$1// \$3\n\$1\$2",
  );
}