Ejemplo n.º 1
0
 public function __construct(&$parser)
 {
     // Call parent constructor.
     parent::__construct($parser);
     //Set up the state machine and pattern matches for transitions.
     // Patterns to handle strings  of the form datefrom:foo
     // If we see the string datefrom: while in the base accept state, start
     // parsing a username and go to the indatefrom state.
     $this->addEntryPattern("datefrom:\\S+", "accept", "indatefrom");
     // Snarf everything into the username until we see whitespace, then exit
     // back to the base accept state.
     $this->addExitPattern("\\s", "indatefrom");
     // Patterns to handle strings  of the form dateto:foo
     // If we see the string dateto: while in the base accept state, start
     // parsing a username and go to the indateto state.
     $this->addEntryPattern("dateto:\\S+", "accept", "indateto");
     // Snarf everything into the username until we see whitespace, then exit
     // back to the base accept state.
     $this->addExitPattern("\\s", "indateto");
     // Patterns to handle strings  of the form instance:foo
     // If we see the string instance: while in the base accept state, start
     // parsing for instance number and go to the ininstance state.
     $this->addEntryPattern("instance:\\S+", "accept", "ininstance");
     // Snarf everything into the username until we see whitespace, then exit
     // back to the base accept state.
     $this->addExitPattern("\\s", "ininstance");
     // Patterns to handle strings  of the form userid:foo
     // If we see the string userid: while in the base accept state, start
     // parsing a username and go to the inuserid state.
     $this->addEntryPattern("userid:\\S+", "accept", "inuserid");
     // Snarf everything into the username until we see whitespace, then exit
     // back to the base accept state.
     $this->addExitPattern("\\s", "inuserid");
     // Patterns to handle strings  of the form user:foo
     // If we see the string user: while in the base accept state, start
     // parsing a username and go to the inusername state.
     $this->addEntryPattern("user:\\S+", "accept", "inusername");
     // Snarf everything into the username until we see whitespace, then exit
     // back to the base accept state.
     $this->addExitPattern("\\s", "inusername");
     // Patterns to handle strings  of the form meta:foo
     // If we see the string meta: while in the base accept state, start
     // parsing a username and go to the inmeta state.
     $this->addEntryPattern("subject:\\S+", "accept", "inmeta");
     // Snarf everything into the meta token until we see whitespace, then exit
     // back to the base accept state.
     $this->addExitPattern("\\s", "inmeta");
     // Patterns to handle required exact match strings (+foo) .
     // If we see a + sign  while in the base accept state, start
     // parsing an exact match string and enter the inrequired state
     $this->addEntryPattern("\\+\\S+", "accept", "inrequired");
     // When we see white space, exit back to accept state.
     $this->addExitPattern("\\s", "inrequired");
     // Handle excluded strings (-foo)
     // If we see a - sign  while in the base accept state, start
     // parsing an excluded string and enter the inexcluded state
     $this->addEntryPattern("\\-\\S+", "accept", "inexcluded");
     // When we see white space, exit back to accept state.
     $this->addExitPattern("\\s", "inexcluded");
     // Patterns to handle quoted strings.
     // If we see a quote  while in the base accept state, start
     // parsing a quoted string and enter the inquotedstring state.
     // Grab everything until we see the closing quote.
     $this->addEntryPattern("\"[^\"]+", "accept", "inquotedstring");
     // When we see a closing quote, reenter the base accept state.
     $this->addExitPattern("\"", "inquotedstring");
     // Patterns to handle ordinary, nonquoted words.
     // When we see non-whitespace, snarf everything into the nonquoted word
     // until we see whitespace again.
     $this->addEntryPattern("\\S+", "accept", "plainstring");
     // Once we see whitespace, reenter the base accept state.
     $this->addExitPattern("\\s", "plainstring");
 }
Ejemplo n.º 2
0
 public function __construct($input)
 {
     parent::__construct($input);
 }
Ejemplo n.º 3
0
Archivo: Parser.php Proyecto: g4z/poop
 /**
  * Construct the Parser object
  */
 public function __construct()
 {
     parent::__construct();
     $this->memory = new Memory();
     $this->extension_manager = new ExtensionManager($this);
 }