forked from CodeExplainedRepo/Snake-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp.xml
More file actions
201 lines (200 loc) · 9.57 KB
/
php.xml
File metadata and controls
201 lines (200 loc) · 9.57 KB
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?xml version="1.0" encoding="UTF-8" ?>
<!-- ==========================================================================\
|
| To learn how to make your own language parser, please check the following
| link:
| https://npp-user-manual.org/docs/function-list/
|
\=========================================================================== -->
<NotepadPlus>
<functionList>
<!-- ========================================================= [ PHP ] -->
<!-- PHP - Personal Home Page / PHP Hypertext Preprocessor -->
<parser
displayName="PHP - Personal Home Page / PHP Hypertext Preprocessor"
id ="php_syntax"
commentExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
(?s:\x2F\x2A.*?\x2A\x2F) # Multi Line Comment x2F -> '/' x2A -> '*'
| (?m-s:(?:\x23|\x2F{2}).*$) # Single Line Comment 1 # and 2 //
# | (?s:\x22(?:[^\x22\x24\x5C]|\x5C.)*\x22) # String Literal - Double Quoted
| (?s:\x22(?:[^\x22\x5C]|\x5C.)*\x22) # String Literal - Double Quoted
| (?s:\x27(?:[^\x27\x5C]|\x5C.)*\x27) # String Literal - Single Quoted
| (?: # Here Document
\x3C{3}(?'HDID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)[^\r\n]*(?:\r?\n|\n?\r)
(?s:.*?)
(?:\r?\n|\n?\r)\k'HDID' # close with exactly the same identifier, in the first column
)
| (?: # Now Document
\x3C{3}\x27(?'NDID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)\x27[^\r\n]*(?:\r?\n|\n?\r)
(?s:.*?)
(?:\r?\n|\n?\r)\k'NDID' # close with exactly the same identifier, in the first column
)
"
>
<classRange
mainExpr ="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
(?(DEFINE) # definition of sub-routines
(?'VALID_ID'
\b(?!(?-i: # keywords (case-sensitive), not to be used as identifier
a(?:bstract|nd|rray|s)
| b(?:ool|reak)
| c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
| d(?:e(?:clare|fault)|ie|o)
| e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
| f(?:alse|loat|inal|or(?:each)?|unction)
| g(?:lobal|oto)
| i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
| list
| mixed
| n(?:amespace|ew|u(?:ll|meric))
| o(?:r|bject)
| p(?:r(?:i(?:nt|vate)|otected)|ublic)
| re(?:quire(?:_once)?|turn)
| s(?:t(?:atic|ring)|witch)
| t(?:hrow|r(?:ait|ue|y))
| u(?:nset|se)
| var
| while
| xor
| __(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
)\b)
[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]* # valid character combination for identifiers
)
(?'INTERFACE_LIST'
\s+(?:\x5C|(?&VALID_ID))+
(?:
\s*,
\s*(?:\x5C|(?&VALID_ID))+
)*
)
)
(?m-i) # ^ and $ match at line-breaks, case-sensitive
^\h* # optional leading white-space at start-of-line
(?:
(?:(?-i:abstract|final)\s+)? # optional class entry type
(?-i:class)\s+
\K # discard text matched so far
(?&VALID_ID) # identifier used as class name
(?: # optional extends-from-class
\s+(?-i:extends)
\s+(?:\x5C|(?&VALID_ID))+
)?
(?: # optional implements-class/interfaces
\s+(?-i:implements)
(?&INTERFACE_LIST)
)?
|
(?-i:interface)\s+
\K # discard text matched so far
(?&VALID_ID) # identifier used as interface name
(?: # optional extends-from list
\s+(?-i:extends)
(?&INTERFACE_LIST)
)?
|
(?-i:trait)\s+
\K # discard text matched so far
(?&VALID_ID) # identifier used as trait name
)
\s*\{
"
openSymbole ="\{"
closeSymbole="\}"
>
<className>
<nameExpr expr="[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" />
</className>
<function
mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
(?m-i) # ^ and $ match at line-breaks, case-sensitive
^\h* # optional leading white-space at start-of-line
(?:(?-i: # field modifiers
p(?:r(?:ivate|otected)|ublic) # - access modifiers
| abstract|final|static # - ...
)\s+)* # require a white-space separator
(?-i:function)\s+
\K # discard text matched so far
(?:\x26\s*)? # optionally a reference
(?'VALID_ID' # valid identifier, use as subroutine
\b(?!(?-i: # keywords (case-sensitive), not to be used as identifier
a(?:bstract|nd|rray|s)
| b(?:ool|reak)
| c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
| d(?:e(?:clare|fault)|ie|o)
| e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
| f(?:alse|loat|inal|or(?:each)?|unction)
| g(?:lobal|oto)
| i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
| list
| mixed
| n(?:amespace|ew|u(?:ll|meric))
| o(?:r|bject)
| p(?:r(?:i(?:nt|vate)|otected)|ublic)
| re(?:quire(?:_once)?|turn)
| s(?:t(?:atic|ring)|witch)
| t(?:hrow|r(?:ait|ue|y))
| u(?:nset|se)
| var
| while
| xor
| __(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
)\b)
[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]* # valid character combination for identifiers
) # identifier used as method name
\s*\( # start of function parameters
(?:[^{;]*(?:\{|;)) # start of function body or abstract function without body
"
>
<functionName>
<funcNameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*\s*\((?:[^/{]|/(?![*/]))*" />
<!-- comment out the following node to display the method with parameters -->
<funcNameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" />
</functionName>
</function>
</classRange>
<function
mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`)
(?m-i) # ^ and $ match at line-breaks, case-sensitive
^\h* # optional leading white-space at start-of-line
(?-i:function)\s+
\K # discard text matched so far
(?:\x26\s*)? # optionally a reference
(?'VALID_ID' # valid identifier, use as subroutine
\b(?!(?-i: # keywords (case-sensitive), not to be used as identifier
a(?:bstract|nd|rray|s)
| b(?:ool|reak)
| c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
| d(?:e(?:clare|fault)|ie|o)
| e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
| f(?:alse|loat|inal|or(?:each)?|unction)
| g(?:lobal|oto)
| i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
| list
| mixed
| n(?:amespace|ew|u(?:ll|meric))
| o(?:r|bject)
| p(?:r(?:i(?:nt|vate)|otected)|ublic)
| re(?:quire(?:_once)?|turn)
| s(?:t(?:atic|ring)|witch)
| t(?:hrow|r(?:ait|ue|y))
| u(?:nset|se)
| var
| while
| xor
| __(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
)\b)
[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]* # valid character combination for identifiers
) # identifier used as function name
\s*\( # start of function parameters
[^{]*\{ # start of function body
"
>
<functionName>
<nameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*\s*\((?:[^/{]|/(?![*/]))*" />
<!-- comment out the following node to display the function with its parameters -->
<!-- <nameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" /> -->
</functionName>
</function>
</parser>
</functionList>
</NotepadPlus>