r5108 findAutoTagWarnings: ability to suppress warnings on plugin-specific autotags
authorAlexey Andriyanov <alan@al-an.info>
Sat, 9 Jun 2012 16:47:42 +0000 (16:47 +0000)
committerAlexey Andriyanov <alan@al-an.info>
Sat, 9 Jun 2012 16:47:42 +0000 (16:47 +0000)
wwwroot/inc/code.php
wwwroot/inc/init.php

index cefca2933325ae3900cda5b9798cb4524bb5b360..7c977b22a7d6ddc503b93d897a1daba8edf4de71 100644 (file)
@@ -878,6 +878,7 @@ function refRCLineno ($ln)
 // Scan the given expression and return any issues found about its autotags.
 function findAutoTagWarnings ($expr)
 {
+       global $user_defined_atags;
        $self = __FUNCTION__;
        switch ($expr['type'])
        {
@@ -971,8 +972,13 @@ function findAutoTagWarnings ($expr)
                                case (preg_match ('/^\$(unmounted|untagged|no_asset_tag|runs_8021Q)$/', $expr['load'])):
                                case (preg_match ('/^\$masklen_(eq|le|ge)_[[:digit:]][[:digit:]]?$/', $expr['load'])):
                                case (preg_match ('/^\$attr_\d+(_\d+)?$/', $expr['load'])):
+                               case (preg_match ('/^\$8021Q_domain_\d+$/', $expr['load'])):
+                               case ('$aggregate' === $expr['load']):
                                        return array();
                                default:
+                                       foreach ($user_defined_atags as $regexp)
+                                               if (preg_match ($regexp, $expr['load']))
+                                                       return array();
                                        return array (array
                                        (
                                                'header' => refRCLineno ($expr['lineno']),
index 3eacc36ebc4eb582a39697a590d3f5245efebf5c..6afae4ad4b6933ce16f6620703badc011450d5c7 100644 (file)
@@ -97,6 +97,10 @@ $auto_tags = array();
 // Initial chain for the current user.
 $user_given_tags = array();
 
+// list of regexps used in findAutoTagWarnings to check RackCode.
+// add your regexps here to suppress 'Martian autotag' warnings
+$user_defined_atags = array();
+
 // This also can be modified in local.php.
 $pageheaders = array
 (