Skip to content
Snippets Groups Projects
  1. Jan 08, 2014
  2. Nov 19, 2013
  3. Nov 05, 2013
  4. Sep 09, 2013
  5. Sep 06, 2013
  6. Sep 05, 2013
  7. Sep 04, 2013
  8. Sep 03, 2013
  9. Sep 02, 2013
  10. Aug 20, 2013
  11. Aug 19, 2013
  12. Aug 02, 2013
  13. Apr 10, 2013
  14. Mar 26, 2013
  15. Mar 20, 2013
  16. Feb 04, 2013
  17. Jan 31, 2013
  18. Jan 29, 2013
  19. Jan 08, 2013
    • Orgad Shaneh's avatar
      Remove braces for single lines of conditions · 29a93998
      Orgad Shaneh authored
      
      #!/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
  20. Nov 28, 2012
  21. Nov 21, 2012
  22. Nov 17, 2012
  23. Nov 12, 2012
  24. Oct 05, 2012
  25. Sep 25, 2012
  26. Sep 13, 2012
  27. Jul 19, 2012
  28. Jun 19, 2012
  29. May 03, 2012
  30. Apr 02, 2012
  31. Mar 12, 2012
  32. Mar 06, 2012
  33. Feb 15, 2012
  34. Feb 09, 2012
  35. Feb 03, 2012
  36. Jan 31, 2012
  37. Jan 30, 2012
  38. Jan 26, 2012
Loading