1<?php 2/** 3 * PHP_ParserGenerator, a php 5 parser generator. 4 * 5 * This is a direct port of the Lemon parser generator, found at 6 * {@link http://www.hwaci.com/sw/lemon/} 7 * 8 * PHP version 5 9 * 10 * LICENSE: 11 * 12 * Copyright (c) 2006, Gregory Beaver <cellog@php.net> 13 * All rights reserved. 14 * 15 * Redistribution and use in source and binary forms, with or without 16 * modification, are permitted provided that the following conditions 17 * are met: 18 * 19 * * Redistributions of source code must retain the above copyright 20 * notice, this list of conditions and the following disclaimer. 21 * * Redistributions in binary form must reproduce the above copyright 22 * notice, this list of conditions and the following disclaimer in 23 * the documentation and/or other materials provided with the distribution. 24 * * Neither the name of the PHP_ParserGenerator nor the names of its 25 * contributors may be used to endorse or promote products derived 26 * from this software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 29 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 30 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 32 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 36 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 * 40 * @category PHP 41 * @package PHP_ParserGenerator 42 * @author Gregory Beaver <cellog@php.net> 43 * @copyright 2006 Gregory Beaver 44 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License 45 * @version CVS: $Id: PropagationLink.php 302382 2010-08-17 06:08:09Z jespino $ 46 * @link http://pear.php.net/package/PHP_ParserGenerator 47 * @since File available since Release 0.1.0 48 */ 49/** 50 * A followset propagation link indicates that the contents of one 51 * configuration followset should be propagated to another whenever 52 * the first changes. 53 * 54 * @category PHP 55 * @package PHP_ParserGenerator 56 * @author Gregory Beaver <cellog@php.net> 57 * @copyright 2006 Gregory Beaver 58 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License 59 * @version Release: @package_version@ 60 * @link http://pear.php.net/package/PHP_ParserGenerator 61 * @since Class available since Release 0.1.0 62 */ 63 64class PHP_ParserGenerator_PropagationLink 65{ 66 /** 67 * The configuration that defines this propagation link 68 * 69 * @var PHP_ParserGenerator_Config 70 */ 71 public $cfp; 72 /** 73 * The next propagation link 74 * 75 * @var PHP_ParserGenerator_PropagationLink|0 76 */ 77 public $next = 0; 78 79 /** 80 * Add a propagation link to the current list 81 * 82 * This prepends the configuration passed in to the first parameter 83 * which is either 0 or a PHP_ParserGenerator_PropagationLink defining 84 * an existing list. 85 * 86 * @param PHP_ParserGenerator_PropagationLink|null 87 * @param PHP_ParserGenerator_Config 88 */ 89 static function Plink_add(&$plpp, PHP_ParserGenerator_Config $cfp) 90 { 91 $new = new PHP_ParserGenerator_PropagationLink; 92 $new->next = $plpp; 93 $plpp = $new; 94 $new->cfp = $cfp; 95 } 96 97 /** 98 * Transfer every propagation link on the list "from" to the list "to" 99 */ 100 static function Plink_copy(PHP_ParserGenerator_PropagationLink &$to, PHP_ParserGenerator_PropagationLink $from) 101 { 102 while ($from) { 103 $nextpl = $from->next; 104 $from->next = $to; 105 $to = $from; 106 $from = $nextpl; 107 } 108 } 109 110 /** 111 * Delete every propagation link on the list 112 * 113 * @param PHP_ParserGenerator_PropagationLink|0 114 * 115 * @return void 116 */ 117 static function Plink_delete($plp) 118 { 119 while ($plp) { 120 $nextpl = $plp->next; 121 $plp->next = 0; 122 $plp = $nextpl; 123 } 124 } 125} 126 127