1 package net.sourceforge.phpeclipse.tests.parser;
2 /*******************************************************************************
3 * Copyright (c) 2002 www.phpeclipse.de All rights
4 * reserved. This program and the accompanying materials are made available
5 * under the terms of the Common Public License v1.0 which accompanies this
6 * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
7 ******************************************************************************/
8 import net.sourceforge.phpdt.core.tests.util.AbstractCompilerTest;
9 import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
11 * Tests the php parser
13 public class OverlibTestCase extends AbstractCompilerTest {
15 public OverlibTestCase(String name) {
19 * Test the PHP Parser with different PHP snippets
21 public void testPHPParser() {
26 " This is version 1.11 of class.overlib for php (http://www.php.net) \r\n" +
28 " written 1999, 2000, 2001 Patrick Hess <hess@dland.de>\r\n" +
30 " This software is distributed under GPL.\r\n" +
32 " overLib is from Eric Bosrup (http://www.bosrup.com/web/overlib/)\r\n" +
34 " This class is just a driver/container, so most of this wonderful\r\n" +
36 " work is done by Eric Bosrup! Keep this in mind... \r\n" +
40 "include(\"hello_world\"); \r\n" +
44 " class Overlib {\r\n" +
46 " public $ol_path = \"modules/Forums\";\r\n" +
48 " public $ol_sticky = false;\r\n" +
50 " public $ol_align = 0;\r\n" +
52 " public $ol_valign = 0;\r\n" +
54 " public $ol_fgcolor = \"#fcfcfc\";\r\n" +
56 " public $ol_bgcolor = \"#0080C0\";\r\n" +
58 " public $ol_capcolor = \"#ffffff\";\r\n" +
60 " public $ol_textcolor = \"\";\r\n" +
62 " public $ol_closecolor = \"\";\r\n" +
64 " public $ol_textfont = \"\";\r\n" +
66 " public $ol_captionfont = \"\";\r\n" +
68 " public $ol_closefont = \"\";\r\n" +
70 " public $ol_textsize = 0;\r\n" +
72 " public $ol_captionsize = 0;\r\n" +
74 " public $ol_closesize = 0;\r\n" +
76 " public $ol_height = 0;\r\n" +
78 " public $ol_width = 0;\r\n" +
80 " public $ol_border = 3;\r\n" +
82 " public $ol_offsetx = 0;\r\n" +
84 " public $ol_offsety = 0;\r\n" +
86 " public $ol_fgbackground = \"\";\r\n" +
88 " public $ol_bgbackground = \"\";\r\n" +
90 " public $ol_closetext = \"Close\";\r\n" +
92 " public $ol_close = true;\r\n" +
94 " public $ol_noclosetext = false;\r\n" +
96 " public $ol_autostatus = false;\r\n" +
98 " public $ol_autostatuscap = false;\r\n" +
100 " public $ol_capicon = \"images/forum/question.gif\";\r\n" +
102 " public $ol_snapx = 0;\r\n" +
104 " public $ol_snapy = 0;\r\n" +
106 " public $ol_padxl = 0;\r\n" +
108 " public $ol_padxr = 0;\r\n" +
110 " public $ol_padyt = 0;\r\n" +
112 " public $ol_padyb = 0;\r\n" +
114 " public $ol_fixy = 0;\r\n" +
116 " public $ol_background = \"\";\r\n" +
118 " public $ol_fullhtml = false;\r\n" +
120 " public $ol_timeout = -1;\r\n" +
122 " public $ol_delay = -1;\r\n" +
124 " public $ol_vauto = false;\r\n" +
126 " public $ol_hauto = false;\r\n" +
130 " function overLib($path = \"\") {\r\n" +
132 " if (strlen($path)) $this->ol_path = $path;\r\n" +
136 "<nolink rel=\'stylesheet\' href=<?php echo \"\'$this->ol_path/overlib.css\' \"; ?> \r\n" +
138 " type=\'text/css\'>\r\n" +
140 "<div id=\'overDiv\' style=\'position:absolute; visibility:hide; z-index: 1000;\'>\r\n" +
144 "<script language=\'javascript\' src=<?php echo \"\'$this->ol_path/overlib.js\'\"; ?>>\r\n" +
154 " function set($var, $value) {\r\n" +
156 " $v = \"ol_$var\";\r\n" +
158 " $this->$v = $value;\r\n" +
164 " function get($var) {\r\n" +
166 " $v = \"ol_$var\";\r\n" +
168 " return($this->$v);\r\n" +
174 " function over($text, $title = \"\", $status = \"\")\r\n" +
178 " $cmd = \"\'$text\'\";\r\n" +
182 " if(strlen($title)) \r\n" +
184 " $cmd .= \", CAPTION, \'$title\'\";\r\n" +
188 " if(strlen($status)) \r\n" +
190 " $cmd .= \", STATUS, \'$status\'\";\r\n" +
194 " if($this->ol_sticky) \r\n" +
196 " $cmd .= \", STICKY\";\r\n" +
200 " if($this->ol_align) {\r\n" +
202 " switch($this->ol_align) {\r\n" +
204 " case 1: $cmd .= \", LEFT\"; break;\r\n" +
206 " case 2: $cmd .= \", CENTER\"; break;\r\n" +
208 " case 3: $cmd .= \", RIGHT\"; break;\r\n" +
210 " default: break;\r\n" +
218 " if($this->ol_valign) {\r\n" +
220 " switch($this->ol_valign) {\r\n" +
222 " case 1: $cmd .= \", ABOVE\"; break;\r\n" +
224 " case 2: $cmd .= \", BELOW\"; break;\r\n" +
226 " default: break;\r\n" +
234 " if (strlen($this->ol_fgbackground)) {\r\n" +
236 " $cmd .= \", FGCOLOR, \'\', FGBACKGROUND, \'$this->ol_fgbackground\'\";\r\n" +
240 " if (strlen($this->ol_fgcolor))\r\n" +
242 " $cmd .= \", FGCOLOR, \'$this->ol_fgcolor\'\";\r\n" +
248 " if (strlen($this->ol_bgbackground)) {\r\n" +
250 " $cmd .= \", BGCOLOR, \'\', BGBACKGROUND, \'$this->ol_bgbackground\'\";\r\n" +
254 " if (strlen($this->ol_bgcolor))\r\n" +
256 " $cmd .= \", BGCOLOR, \'$this->ol_bgcolor\'\";\r\n" +
262 " if (strlen($this->ol_capcolor))\r\n" +
264 " $cmd .= \", CAPCOLOR, \'$this->ol_capcolor\'\";\r\n" +
268 " if (strlen($this->ol_textcolor))\r\n" +
270 " $cmd .= \", TEXTCOLOR, \'$this->ol_textcolor\'\";\r\n" +
274 " if (strlen($this->ol_closecolor))\r\n" +
276 " $cmd .= \", CLOSECOLOR, \'$this->ol_closecolor\'\";\r\n" +
280 " if (strlen($this->ol_textfont))\r\n" +
282 " $cmd .= \", TEXTFONT, \'$this->ol_textfont\'\";\r\n" +
286 " if (strlen($this->ol_captionfont))\r\n" +
288 " $cmd .= \", CAPTIONFONT, \'$this->ol_captionfont\'\";\r\n" +
292 " if (strlen($this->ol_closefont))\r\n" +
294 " $cmd .= \", CLOSEFONT, \'$this->ol_closefont\'\";\r\n" +
298 " if ($this->ol_textsize)\r\n" +
300 " $cmd .= \", TEXTSIZE, $this->ol_textsize\";\r\n" +
304 " if ($this->ol_captionsize)\r\n" +
306 " $cmd .= \", CAPTIONSIZE, $this->ol_captionsize\";\r\n" +
310 " if ($this->ol_closesize)\r\n" +
312 " $cmd .= \", CLOSESIZE, $this->ol_closesize\";\r\n" +
316 " if ($this->ol_width)\r\n" +
318 " $cmd .= \", WIDTH, $this->ol_width\";\r\n" +
322 " if ($this->ol_height)\r\n" +
324 " $cmd .= \", HEIGHT, $this->ol_height\";\r\n" +
328 " if ($this->ol_border >= 0)\r\n" +
330 " $cmd .= \", BORDER, $this->ol_border\";\r\n" +
334 " if ($this->ol_offsetx)\r\n" +
336 " $cmd .= \", OFFSETX, $this->ol_offsetx\";\r\n" +
340 " if ($this->ol_offsety)\r\n" +
342 " $cmd .= \", OFFSETY, $this->ol_offsety\";\r\n" +
346 " if (strlen($this->ol_closetext))\r\n" +
348 " $cmd .= \", CLOSETEXT, \'$this->ol_closetext\'\";\r\n" +
352 " if ($this->ol_noclose)\r\n" +
354 " $cmd .= \", NOCLOSETEXT\";\r\n" +
358 " if ($this->ol_autostatus)\r\n" +
360 " $cmd .= \", AUTOSTATUS\";\r\n" +
364 " if ($this->ol_autostatuscap)\r\n" +
366 " $cmd .= \", AUTOSTATUSCAP\";\r\n" +
370 " if (strlen($this->ol_capicon))\r\n" +
372 " $cmd .= \", CAPICON, \'$this->ol_capicon\'\";\r\n" +
376 " if ($this->ol_snapx)\r\n" +
378 " $cmd .= \", SNAPX, $this->ol_snapx\";\r\n" +
382 " if ($this->ol_snapy)\r\n" +
384 " $cmd .= \", SNAPY, $this->ol_snapy\";\r\n" +
388 " if ($this->ol_fixy)\r\n" +
390 " $cmd .= \", FIXY, $this->ol_fixy\";\r\n" +
394 " if ($this->ol_padxl || $this->ol_padxr)\r\n" +
396 " $cmd .= \", PADX, $this->ol_padxl, $this->ol_padxr\";\r\n" +
400 " if ($this->ol_padyt || $this->ol_padyb)\r\n" +
402 " $cmd .= \", PADY, $this->ol_padyt, $this->ol_padyb\";\r\n" +
406 " if (strlen($this->ol_background))\r\n" +
408 " $cmd .= \", BACKGROUND, \'$this->ol_background\'\";\r\n" +
412 " if ($this->ol_fullhtml)\r\n" +
414 " $cmd .= \", FULLHTML\";\r\n" +
418 " if ($this->ol_timeout >= 0)\r\n" +
420 " $cmd .= \", TIMEOUT, $this->ol_timeout\";\r\n" +
424 " if ($this->ol_delay >= 0)\r\n" +
426 " $cmd .= \", DELAY, $this->ol_delay\";\r\n" +
430 " if ($this->ol_hauto) {\r\n" +
432 " $cmd .= \", HAUTO\";\r\n" +
434 " $this->ol_hauto = false;\r\n" +
440 " if ($this->ol_vauto) {\r\n" +
442 " $cmd .= \", VAUTO\";\r\n" +
444 " $this->ol_hauto = false;\r\n" +
450 " $output=\" onMouseOver=\\\"return overlib($cmd);\\\" \";\r\n" +
452 " $output.=\" onMouseOut=\\\"nd();\\\" \";\r\n" +
456 " return ($output);\r\n" +
462 " function pover ($text, $title = \"\", $status = \"\") \r\n" +
466 " echo $this->over($text, $title, $status);\r\n" +
480 private void checkPHP(String strEval) {
482 System.out.println("\n------------------------------------");
483 System.out.println(strEval);
486 strEval.toCharArray(),
488 // parser.phpParserTester(strEval, 1);
490 // private void checkHTML(String strEval) {
491 // if (Scanner.DEBUG) {
492 // System.out.println("\n------------------------------------");
493 // System.out.println(strEval);
496 // strEval.toCharArray(),
498 //// parser.phpParserTester(strEval, 1);