summaryrefslogtreecommitdiff
path: root/tw/lang/TW_lang.php
blob: 95c93b03187c332603a9b081d3b30fc7c79c3067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php
/*
 * tag|wall                                           | PHP Tag Filter |
 * ---------------------------------------------------------------------

   Copyright (C) 2002  Juraj 'HVGE' Durech
   Copyright (C) 2002  www.designia.sk
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
   
 * ---------------------------------------------------------------------
 * TW - based on SHL Language File
 * 
 * Spolocne so SHL
 * - kompatibilita s FSHL generatorom 0.4.x
 * - zakladna kostra stavoveho diagramu je spolocna
 *
 * Rozdiely voci SHL
 * - polia maju iny vyznam pretoze spracuva iny stavovy automat
 * - vsetky stavy sa volaju rekurentne
 *
 * function STATE_in()  - vola sa pri vstupe do stavu (Ovplyvnuje flag PF_XIO)
 * function STATE_out() - vola sa pri opusteni stavu (_RET) (Ovplyvnuje flag PF_XIO)
 *                        tiez hned po navrate z rekurzie flag PF_XDONE sposobi zavolanie
 *                        STATE_out() a opustenie aktualneho stavu (simulovany _RET)
 * function STATE_new() - vola sa pri zmene stavu (Ovplyvnuje flag PF_XNEW)
 */ 
class TW_lang
{
	var $states;
	var $initial_state;
	var $keywords;
	var $version;
	var $signature;

	function TW_lang()
	{
		$this->signature = "TW";
		$this->version = "1.0";
		$this->initial_state="OUT";
		$this->states = 
		array
		(
		"OUT" => array (
				array(
						"<"		=> array("T_tagWall",0),
						
						//"&"		=> array("VChar",0),		// validate char (currently not implemented in base)						
						),

				PF_CLEAN,		// PF_CLEAN - znaky sa forwarduju na vystup
				0,0
				),

		"T_tagWall" => array (
				array(
						"ALPHA" => array("T_begin",1),		// normal tag
						"/"		=> array("T_Cbegin",0),		// close tag
						"<"		=> array("T_tagWall",1),	// '<<<<<<<<' fix (faster than _RET)
						"!--"	=> array("HTML_comment",0),
						"_ALL"	=> array("_RET",0),			// '<?' other fixes
						),
			
				PF_XDONE,
				0,0
				),


		"T_Cbegin" => array (
				array(
						"ALPHA"	=> array("T_gettag",1),
						"_ALL"	=> array("_RET",0),
						),
				PF_XIO | PF_XDONE,						0,0
				),


		"T_begin" => array (
				array(
						"ALPHA"	=> array("T_gettag",1),
						"_ALL"	=> array("_RET",0),
						),
				
				PF_XIO | PF_XDONE,						0,0
				),

			
		"T_gettag" => array (
				array(
						"!ALNUM"=> array("T_in",1),
						),
						
				PF_XIO | PF_XDONE | PF_XNEW,			0,0
				),


		"T_in" => array(
				array(
						"ALPHA"	=> array("A_begin",1),	// char back to stream
						">"		=> array("_RET",0),
						"/>"	=> array("_RET",0),		// pozor na spracovanie v T_begin
						),
				
				0,0,0
				),

		"A_begin" => array (
				array(
						"!ALPHA"=> array("V_begin",1),
						">"		=> array("_RET",1),		// vracia string do streamu
						"/>"	=> array("_RET",1),		// pozor na spracovanie v TAGbegin
						),
				
				PF_XIO | PF_XDONE | PF_XNEW ,			0,0
				),

		// this is wide attribute=value implementation
		"V_begin" => array (
				array(
						'"'		=> array("VALUE1",0),
						"'"		=> array("VALUE2",0),
						"ALNUM" => array("VALUE3",1),

						">"		=> array("_RET",1),
						"/>"	=> array("_RET",1),
						),

				PF_XIO | PF_XDONE,						0,0
				),
			
		// "DOUBLEQUOTED VALUE"
		"VALUE1" => array(
				array(
						'"'		=> array("_RET",0),
						),
				PF_XIO,									0,0
				),

		// 'SINGLEQUOTED VALUE'
		"VALUE2" => array(
				array(
						"'"		=> array("_RET",0),
						),
				PF_XIO,									0,0
				),

		// UNQUOTEDVALUE99
		"VALUE3" => array(
				array(
/*						"_" => array ("VALUE3",0),	//Uncomment for better HTML4 compatibility (not recommended)
						"." => array ("VALUE3",0), 
*/
						"-" => array ("VALUE3",0),
						"!ALNUM"=> array("_RET",1),
						),
				PF_XIO,									0,0
				),

		// all comment content will be removed
		"HTML_comment" => array(
				array(
						"-->"	=> array("_RET",0),
						),
				0,0,0
				),
		);
		
		$this->keywords=null;
	}
}
?>