[Fusionforge-commits] r11866 - trunk/src/utils

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Dec 21 10:23:57 CET 2010


Author: lolando
Date: 2010-12-21 10:23:56 +0100 (Tue, 21 Dec 2010)
New Revision: 11866

Modified:
   trunk/src/utils/apply-coding-style.sh
Log:
More work on beautifier, still not complete

Modified: trunk/src/utils/apply-coding-style.sh
===================================================================
--- trunk/src/utils/apply-coding-style.sh	2010-12-21 09:01:47 UTC (rev 11865)
+++ trunk/src/utils/apply-coding-style.sh	2010-12-21 09:23:56 UTC (rev 11866)
@@ -5,9 +5,11 @@
 # DO NOT APPLY BLINDLY!
 
 # Things to fix:
-# * long lines (such as appear with long lists of parameters to functions) are unwrapped
-#   even when they were previously split across several lines
 
+# * Indentation is wrong inside parenthesis (next line starts with an
+#  extra tab rather than aligned with the first element in the paren)
+# * =& becomes = &
+
 set -e
 
 arg=$1
@@ -27,9 +29,38 @@
     git checkout 15e6c66d2b2473cd3487c86ab9b2e3d5ed567ee7
     ln -s . PHP
     patch -p1 <<'EOF'
+diff --git a/Beautifier/Filter/Default.filter.php b/Beautifier/Filter/Default.filter.php
+index 3df2578..857b584 100755
 --- a/Beautifier/Filter/Default.filter.php
 +++ b/Beautifier/Filter/Default.filter.php
-@@ -231,9 +231,6 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
+@@ -49,6 +49,7 @@
+ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
+ {
+     protected $sDescription = 'Default Filter for PHP_Beautifier';
++    private $paren_level = 0;
+     /**
+      * __call 
+      * 
+@@ -192,6 +193,8 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
+     function t_parenthesis_open($sTag) 
+     {
+         $this->oBeaut->add($sTag);
++	$this->oBeaut->incIndent();
++	$this->paren_level++;
+     }
+     /**
+      * t_parenthesis_close 
+@@ -210,7 +213,8 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
+         if (!$this->oBeaut->isNextTokenContent(';')) {
+             $this->oBeaut->add(' ');
+         }
+-        
++	$this->oBeaut->decIndent();
++	$this->paren_level--;
+     }
+     /**
+      * t_open_brace 
+@@ -231,9 +235,6 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
                  $this->oBeaut->add($sTag);
              }
              $this->oBeaut->incIndent();
@@ -39,7 +70,7 @@
              $this->oBeaut->addNewLineIndent();
          }
      }
-@@ -254,9 +251,6 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
+@@ -254,9 +255,6 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
          } else {
              $this->oBeaut->removeWhitespace();
              $this->oBeaut->decIndent();
@@ -49,8 +80,21 @@
              $this->oBeaut->addNewLineIndent();
              $this->oBeaut->add($sTag);
              if ($this->oBeaut->getControlSeq() == T_DO) {
-@@ -678,10 +672,8 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
+@@ -318,7 +316,11 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
+     function t_whitespace($sTag) 
      {
+         $matches = "";
+-        $minNL = 2;
++	if ($this->paren_level) {
++		$minNL = 1;
++	} else {
++		$minNL = 2;
++	}
+         if($this->oBeaut->isPreviousTokenConstant(T_COMMENT)) {
+             $prevToken = $this->oBeaut->getPreviousTokenContent(1);
+             $tokenEnd = substr($prevToken,strlen($prevToken)-2);
+@@ -678,10 +680,8 @@ final class PHP_Beautifier_Filter_Default extends PHP_Beautifier_Filter
+     {
          if ($this->oBeaut->getControlSeq() == T_SWITCH) {
              $this->oBeaut->removeWhitespace();
 -            $this->oBeaut->decIndent();
@@ -60,6 +104,8 @@
          } else {
              $this->oBeaut->add($sTag);
          }
+diff --git a/Beautifier/Filter/IndentStyles.filter.php b/Beautifier/Filter/IndentStyles.filter.php
+index fa98c45..ee57eb3 100755
 --- a/Beautifier/Filter/IndentStyles.filter.php
 +++ b/Beautifier/Filter/IndentStyles.filter.php
 @@ -265,7 +265,7 @@ class PHP_Beautifier_Filter_IndentStyles extends PHP_Beautifier_Filter




More information about the Fusionforge-commits mailing list