Skip to content
Snippets Groups Projects
Select Git revision
  • 29a93998df8405e8799ad23934a56cd99fb36403
  • master default
  • 4.5
  • 4.4
  • 4.1
  • 4.3
  • 4.2
  • wip/clang-query
  • 4.0
  • 3.6
  • at-master
  • qp-master
  • csa-master
  • at-3.6
  • qp-3.6
  • csa-3.6
  • 3.5
  • at-3.5
  • csa-3.5
  • wip/boostbuildprojectmanager
  • 3.4
  • v4.5.0
  • v4.5.0-rc1
  • v4.5.0-beta1
  • v4.4.1
  • v4.4.0
  • v4.4.0-rc1
  • v4.4.0-beta1
  • v4.3.1
  • v4.3.0
  • v4.3.0-rc1
  • v4.2.2
  • v4.3.0-beta1
  • v4.2.1
  • v4.2.0
  • v4.2.0-rc1
  • v4.2.0-beta1
  • v4.1.0
  • v4.1.0-rc1
  • v4.0.3
  • v4.1.0-beta1
41 results

cplusplus

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Orgad Shaneh authored and hjk committed
    #!/usr/bin/env ruby
    
    Dir.glob('**/*.cpp') { |file|
      # skip ast (excluding paste, astpath, and canv'ast'imer)
      next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
      s = File.read(file)
      next if s.include?('qlalr')
      orig = s.dup
      s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
        res = $&
        if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
          res
        else
          res.gsub!('} else', 'else')
          res.gsub!(/\n +} *\n/m, "\n")
          res.gsub(/ *{$/, '')
        end
      }
      s.gsub!(/ *$/, '')
      File.open(file, 'wb').write(s) if s != orig
    }
    
    Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
    Reviewed-by: default avatarhjk <qthjk@ovi.com>
    29a93998
    History
    Name Last commit Last update
    ..