[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/events/ -> VTEventConditionParserParser.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  
  11  // $ANTLR 3.1 VTEventConditionParser.g 2009-01-23 20:13:10              
  12  
  13  class VTEventConditionParserParser extends AntlrParser {
  14      public static $tokenNames = array(
  15          "<invalid>", "<EOR>", "<DOWN>", "<UP>", "SYMBOL", "IN", "STRING", "DIGIT", "INTEGER", "LETTER", "DOT", "ELEMENT_ID", "WHITESPACE", "'=='", "'['", "','", "']'"
  16      );
  17      public $INTEGER=8;
  18      public $T__16=16;
  19      public $IN=5;
  20      public $T__15=15;
  21      public $SYMBOL=4;
  22      public $LETTER=9;
  23      public $T__14=14;
  24      public $T__13=13;
  25      public $WHITESPACE=12;
  26      public $DIGIT=7;
  27      public $DOT=10;
  28      public $EOF=-1;
  29      public $ELEMENT_ID=11;
  30      public $STRING=6;
  31  
  32      // delegates
  33      // delegators
  34      
  35      static $FOLLOW_comparision_in_statement57;
  36      static $FOLLOW_inclause_in_statement63;
  37      static $FOLLOW_SYMBOL_in_comparision78;
  38      static $FOLLOW_13_in_comparision80;
  39      static $FOLLOW_value_in_comparision84;
  40      static $FOLLOW_SYMBOL_in_inclause101;
  41      static $FOLLOW_IN_in_inclause103;
  42      static $FOLLOW_listelement_in_inclause107;
  43      static $FOLLOW_14_in_listelement122;
  44      static $FOLLOW_value_in_listelement126;
  45      static $FOLLOW_15_in_listelement137;
  46      static $FOLLOW_value_in_listelement141;
  47      static $FOLLOW_16_in_listelement147;
  48      static $FOLLOW_STRING_in_value162;
  49  
  50      
  51      
  52  
  53          public function __construct($input, $state = null) {
  54              if($state==null){
  55                  $state = new RecognizerSharedState();
  56              }
  57              parent::__construct($input, $state);
  58               
  59              
  60              
  61          }
  62          
  63  
  64      public function getTokenNames() { return VTEventConditionParserParser::$tokenNames; }
  65      public function getGrammarFileName() { return "VTEventConditionParser.g"; }
  66  
  67       
  68      	protected function mismatch($input, $ttype, $follow){ 
  69              throw new MismatchedTokenException($ttype, $input); 
  70          }
  71      	public function recoverFromMismatchedSet($input, $e, $follow){ 
  72              throw $e;
  73          } 
  74  
  75  
  76  
  77      // $ANTLR start "statement"
  78      ///* VTEventConditionParser.g:33:1: statement returns [result] : (exp= comparision | exp= inclause ) ; */
  79      public function statement(){
  80          $result = null;
  81  
  82          $exp = null;
  83  
  84  
  85          try {
  86              {
  87              $alt1=2;
  88              $LA1_0 = $this->input->LA(1);
  89  
  90              if ( ($LA1_0==$this->getToken('SYMBOL')) ) {
  91                  $LA1_1 = $this->input->LA(2);
  92  
  93                  if ( ($LA1_1==$this->getToken('13')) ) {
  94                      $alt1=1;
  95                  }
  96                  else if ( ($LA1_1==$this->getToken('IN')) ) {
  97                      $alt1=2;
  98                  }
  99                  else {
 100                      if ($this->state->backtracking>0) {$this->state->failed=true; return $result;}
 101                      $nvae = new NoViableAltException("", 1, 1, $this->input);
 102  
 103                      throw $nvae;
 104                  }
 105              }
 106              else {
 107                  if ($this->state->backtracking>0) {$this->state->failed=true; return $result;}
 108                  $nvae = new NoViableAltException("", 1, 0, $this->input);
 109  
 110                  throw $nvae;
 111              }
 112              switch ($alt1) {
 113                  case 1 :
 114                      {
 115                      $this->pushFollow(self::$FOLLOW_comparision_in_statement57);
 116                      $exp=$this->comparision();
 117  
 118                      $this->state->_fsp--;
 119                      if ($this->state->failed) return $result;
 120  
 121                      }
 122                      break;
 123                  case 2 :
 124                      {
 125                      $this->pushFollow(self::$FOLLOW_inclause_in_statement63);
 126                      $exp=$this->inclause();
 127  
 128                      $this->state->_fsp--;
 129                      if ($this->state->failed) return $result;
 130  
 131                      }
 132                      break;
 133  
 134              }
 135  
 136              if ( $this->state->backtracking==0 ) {
 137                $result=$exp;
 138              }
 139  
 140              }
 141  
 142          }
 143           
 144              catch (RecognitionException $e) { 
 145                  throw $e; 
 146              } 
 147          catch(Exception $e) {
 148              throw $e;
 149          }
 150          
 151          return $result;
 152      }
 153      // $ANTLR end "statement"
 154  
 155  
 156      // $ANTLR start "comparision"
 157      ///* VTEventConditionParser.g:35:1: comparision returns [result] : lhs= SYMBOL '==' rhs= value ; */
 158      public function comparision(){
 159          $result = null;
 160  
 161          $lhs=null;
 162          $rhs = null;
 163  
 164  
 165          try {
 166              {
 167              $lhs=$this->match($this->input,$this->getToken('SYMBOL'),self::$FOLLOW_SYMBOL_in_comparision78); if ($this->state->failed) return $result;
 168              $this->match($this->input,$this->getToken('13'),self::$FOLLOW_13_in_comparision80); if ($this->state->failed) return $result;
 169              $this->pushFollow(self::$FOLLOW_value_in_comparision84);
 170              $rhs=$this->value();
 171  
 172              $this->state->_fsp--;
 173              if ($this->state->failed) return $result;
 174              if ( $this->state->backtracking==0 ) {
 175                $result=array('==', new VTEventConditionSymbol(($lhs!=null?$lhs->getText():null)), $rhs); echo $value;
 176              }
 177  
 178              }
 179  
 180          }
 181           
 182              catch (RecognitionException $e) { 
 183                  throw $e; 
 184              } 
 185          catch(Exception $e) {
 186              throw $e;
 187          }
 188          
 189          return $result;
 190      }
 191      // $ANTLR end "comparision"
 192  
 193  
 194      // $ANTLR start "inclause"
 195      ///* VTEventConditionParser.g:38:1: inclause returns [result] : lhs= SYMBOL IN rhs= listelement ; */
 196      public function inclause(){
 197          $result = null;
 198  
 199          $lhs=null;
 200          $rhs = null;
 201  
 202  
 203          try {
 204              {
 205              $lhs=$this->match($this->input,$this->getToken('SYMBOL'),self::$FOLLOW_SYMBOL_in_inclause101); if ($this->state->failed) return $result;
 206              $this->match($this->input,$this->getToken('IN'),self::$FOLLOW_IN_in_inclause103); if ($this->state->failed) return $result;
 207              $this->pushFollow(self::$FOLLOW_listelement_in_inclause107);
 208              $rhs=$this->listelement();
 209  
 210              $this->state->_fsp--;
 211              if ($this->state->failed) return $result;
 212              if ( $this->state->backtracking==0 ) {
 213                $result=array('in', new VTEventConditionSymbol(($lhs!=null?$lhs->getText():null)), $rhs);
 214              }
 215  
 216              }
 217  
 218          }
 219           
 220              catch (RecognitionException $e) { 
 221                  throw $e; 
 222              } 
 223          catch(Exception $e) {
 224              throw $e;
 225          }
 226          
 227          return $result;
 228      }
 229      // $ANTLR end "inclause"
 230  
 231  
 232      // $ANTLR start "listelement"
 233      ///* VTEventConditionParser.g:40:1: listelement returns [result] : '[' val= value ( ',' val= value )* ']' ; */
 234      public function listelement(){
 235          $result = null;
 236  
 237          $val = null;
 238  
 239  
 240          try {
 241              {
 242              $this->match($this->input,$this->getToken('14'),self::$FOLLOW_14_in_listelement122); if ($this->state->failed) return $result;
 243              $this->pushFollow(self::$FOLLOW_value_in_listelement126);
 244              $val=$this->value();
 245  
 246              $this->state->_fsp--;
 247              if ($this->state->failed) return $result;
 248              if ( $this->state->backtracking==0 ) {
 249                $result = array('list', $val);
 250              }
 251              //loop2:
 252              do {
 253                  $alt2=2;
 254                  $LA2_0 = $this->input->LA(1);
 255  
 256                  if ( ($LA2_0==$this->getToken('15')) ) {
 257                      $alt2=1;
 258                  }
 259  
 260  
 261                  switch ($alt2) {
 262                  case 1 :
 263                      {
 264                      $this->match($this->input,$this->getToken('15'),self::$FOLLOW_15_in_listelement137); if ($this->state->failed) return $result;
 265                      $this->pushFollow(self::$FOLLOW_value_in_listelement141);
 266                      $val=$this->value();
 267  
 268                      $this->state->_fsp--;
 269                      if ($this->state->failed) return $result;
 270                      if ( $this->state->backtracking==0 ) {
 271                        $result[] = $val;
 272                      }
 273  
 274                      }
 275                      break;
 276  
 277                  default :
 278                      break 2;//loop2;
 279                  }
 280              } while (true);
 281  
 282              $this->match($this->input,$this->getToken('16'),self::$FOLLOW_16_in_listelement147); if ($this->state->failed) return $result;
 283  
 284              }
 285  
 286          }
 287           
 288              catch (RecognitionException $e) { 
 289                  throw $e; 
 290              } 
 291          catch(Exception $e) {
 292              throw $e;
 293          }
 294          
 295          return $result;
 296      }
 297      // $ANTLR end "listelement"
 298  
 299  
 300      // $ANTLR start "value"
 301      ///* VTEventConditionParser.g:44:1: value returns [result] : val= STRING ; */
 302      public function value(){
 303          $result = null;
 304  
 305          $val=null;
 306  
 307          try {
 308              {
 309              $val=$this->match($this->input,$this->getToken('STRING'),self::$FOLLOW_STRING_in_value162); if ($this->state->failed) return $result;
 310              if ( $this->state->backtracking==0 ) {
 311                $result = stripcslashes(substr(($val!=null?$val->getText():null), 1, strlen(($val!=null?$val->getText():null))-2));
 312              }
 313  
 314              }
 315  
 316          }
 317           
 318              catch (RecognitionException $e) { 
 319                  throw $e; 
 320              } 
 321          catch(Exception $e) {
 322              throw $e;
 323          }
 324          
 325          return $result;
 326      }
 327      // $ANTLR end "value"
 328  
 329      // Delegated rules
 330  
 331  
 332      
 333  }
 334  
 335   
 336  
 337  
 338  
 339  VTEventConditionParserParser::$FOLLOW_comparision_in_statement57 = new Set(array(1));
 340  VTEventConditionParserParser::$FOLLOW_inclause_in_statement63 = new Set(array(1));
 341  VTEventConditionParserParser::$FOLLOW_SYMBOL_in_comparision78 = new Set(array(13));
 342  VTEventConditionParserParser::$FOLLOW_13_in_comparision80 = new Set(array(6));
 343  VTEventConditionParserParser::$FOLLOW_value_in_comparision84 = new Set(array(1));
 344  VTEventConditionParserParser::$FOLLOW_SYMBOL_in_inclause101 = new Set(array(5));
 345  VTEventConditionParserParser::$FOLLOW_IN_in_inclause103 = new Set(array(14));
 346  VTEventConditionParserParser::$FOLLOW_listelement_in_inclause107 = new Set(array(1));
 347  VTEventConditionParserParser::$FOLLOW_14_in_listelement122 = new Set(array(6));
 348  VTEventConditionParserParser::$FOLLOW_value_in_listelement126 = new Set(array(15, 16));
 349  VTEventConditionParserParser::$FOLLOW_15_in_listelement137 = new Set(array(6));
 350  VTEventConditionParserParser::$FOLLOW_value_in_listelement141 = new Set(array(15, 16));
 351  VTEventConditionParserParser::$FOLLOW_16_in_listelement147 = new Set(array(1));
 352  VTEventConditionParserParser::$FOLLOW_STRING_in_value162 = new Set(array(1));
 353  
 354  ?>


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1