cvs: php-lang / genoplist.php

[email protected] ("Sascha Schumann")
Newsgroups php.lang
Message-ID <cvssas974843427@cvsserver>
sas		Tue Nov 21 13:50:27 2000 EDT

  Added files:
    /php-lang	genoplist.php 
  Log:
  Script for generating a list of rules for standard operators
  
  

Index: php-lang/genoplist.php
+++ php-lang/genoplist.php
<?

# Generate a cascade of rules for operators
# Higher rules have precedence
# $Id: genoplist.php,v 1.1 2000/11/21 21:50:27 sas Exp $

$a = array(
		"multiplicative", "*,/,%",
		"additive",       "+,-",
		"shift",          "<<,>>",
		"relational",     "<,>,<=,>=",
		"identical",      "===,!==",
		"equality",       "==,!=",
		"and",            "&",
		"exclusive-or",   "^",
		"inclusive-or",   "|",
		"logical-and",    "&&",
		"logical-or",     "||"
		);

$last = "cast";

for ($i = 0; $i < count($a); $i += 2) {
	$key = $a[$i];
	$ops = $a[$i+1];

	print "$key-expression:\n";
	print "    $last-expression\n";
	foreach (explode(",", $ops) as $op) {
		print "    $key-expression '$op' $last-expression\n";
	}
	print "\n";

	$last = $key;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.