File: mode.php

package info (click to toggle)
geany 2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 39,300 kB
  • sloc: ansic: 168,600; cpp: 77,562; sh: 5,344; makefile: 1,694; cs: 1,233; javascript: 1,024; python: 580; f90: 537; vhdl: 504; sql: 503; lisp: 436; fortran: 389; php: 278; ada: 201; ruby: 163; java: 131; asm: 131; perl: 119; cobol: 88; tcl: 77; erlang: 73; xml: 66; ml: 27; sed: 16; pascal: 15; haskell: 6
file content (125 lines) | stat: -rw-r--r-- 1,744 bytes parent folder | download | duplicates (9)
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
Tests for entering and leaving PHP mode

Expected output is

functions:
	a
	b
	c
	d
	e
	f
	g
	h
	i
	j


function bug0() {
	// this should not appear
}

<?php // entering PHP mode, classic method

function a() {}

?> // PHP mode left

function bug1() {}

<? // entering PHP mode, short open tag

function b() {}

?> // PHP mode left

function bug2() {}

<?php // entering PHP mode

// this WILL leave PHP mode: ?>

function bug3() {}

<? // entering PHP mode

function c() {
	?> // PHP mode left
	function bug4() {
	}
	<? // back to PHP mode, still inside function c()
}

function d() {
	?> // same here
	function bug5() {
	}
	<?php // back to PHP mode, still inside function d()
}

// any open tag matches any close tag, so this is valid
</script> // leaves PHP mode

function bug4() {}

?> <!-- just in case -->

<script language="php"> // enetered PHP mode

function e() {
	return 42;
}

?> // left PHP mode

function bug5() {}

// some valid long tag opening with inner whitespaces

<script
	language
	=
	php
> // entered
function f() {}
</script
	> // left

function bug6() {}

<script	language=	'php'	> // enter
function g() {}
</script > // leave

function bug7() {}

<?php
// this WONT leave PHP mode, it's in a comment  </script>
function h() {}
?>

function bug8() {}

<?php

function i() {}
// any open tag matches any close tag, so this is valid
</script         	  	 
 	  	        >

function bug9() {}

// this won't enter PHP, no spaces are allowed between the "<" and "script"
< script language = php >

function bug10() {}

// does nothing, just resets mode for some tools not aware of the "script" thing
?>

<!-- <script> is OK anywhere, even in XML strings -->
<p attr="<script language=php>
function j() {}
</script>">

</p>