-
Notifications
You must be signed in to change notification settings - Fork 11
/
hack-mode.el
1883 lines (1725 loc) · 84.7 KB
/
hack-mode.el
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; hack-mode.el --- Major mode for the Hack programming language -*- lexical-binding: t -*-
;; Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
;; 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 3 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, see <https://www.gnu.org/licenses/>.
;; Author: John Allen <[email protected]>, Wilfred Hughes <[email protected]>
;; Version: 1.4.0
;; Package-Requires: ((emacs "25.1") (s "1.11.0"))
;; URL: https://github.com/hhvm/hack-mode
;;; Commentary:
;;
;; Implements `hack-mode' for the Hack programming language. This
;; includes support for highlighting and indentation.
;;
;;; Formatting:
;;
;; `hack-mode' provides `hack-format-buffer' to run hackfmt on the
;; whole file. If you'd like this automatically run on save, add it to
;; your hooks.
;;
;; (add-hook 'hack-mode-hook #'hack-enable-format-on-save)
;;
;;; Replacing `php-mode':
;;
;; If you also have `php-mode' installed, Emacs will use `php-mode'
;; for .php files. You can use `hack-mode' for .php by adding the
;; following to your configuration:
;;
;; (add-to-list 'auto-mode-alist '("\\.php\\'" . hack-mode))
;;; Code:
(require 's)
(defgroup hack nil
"Major mode `hack-mode' for editing Hack code."
:prefix "hack-"
:group 'languages)
(defcustom hack-client-program-name "hh_client"
"The command to run to communicate with hh_server."
:type 'string
:group 'hack-mode)
(defcustom hack-format-on-save nil
"Format the current buffer on save."
:type 'boolean
:safe #'booleanp
:group 'hack-mode)
(defcustom hack-hackfmt-name "hackfmt"
"The command to run to format code."
:type 'string
:group 'hack-mode)
(defcustom hack-indent-offset 2
"Indentation amount (in spaces) for Hack code."
:safe #'integerp
:type 'integer
:group 'hack-mode)
(defface hack-xhp-tag
'((t . (:inherit font-lock-function-name-face)))
"Face used to highlight XHP tags in `hack-mode' buffers."
:group 'hack-mode)
(defun hack--propertize-xhp ()
"Put syntax properties on XHP blocks."
(let* ((start-pos (match-beginning 1))
(ppss (save-excursion (syntax-ppss start-pos)))
(in-comment (nth 4 ppss)))
(unless in-comment
(hack--forward-parse-xhp start-pos nil)
;; Point is now at the end of the XHP section.
(let ((end-pos (point)))
(goto-char start-pos)
;; Ensure that ' is not treated as a string delimiter, unless
;; we're in an XHP interpolated region.
(while (search-forward "'" end-pos t)
(let* ((ppss (syntax-ppss))
(paren-pos (nth 1 ppss)))
(when (or (null paren-pos)
(> start-pos paren-pos))
(put-text-property (1- (point)) (point)
'syntax-table
(string-to-syntax ".")))))
;; We need to leave point after where we started, or we get an
;; infinite loop.
(goto-char end-pos)))))
(defun hack--propertize-heredoc ()
"Put `syntax-table' text properties on heredoc and nowdoc string literals.
See <http://php.net/manual/en/language.types.string.php>."
;; Point starts just after the <<<, so the start position is three
;; chars back.
(let ((start-pos (match-beginning 0))
(identifier (match-string 1)))
;; Nowdoc literals have the form
;; $x <<<'FOO'
;; bar
;; FOO; // unquoted at end.
(setq identifier
(s-chop-suffix "'" (s-chop-prefix "'" identifier)))
;; The closing identifier must be at the beginning of a line.
(search-forward (format "\n%s" identifier) nil t)
;; Mark the beginning < as a string beginning, so we don't think
;; any ' or " inside the heredoc are string delimiters.
(put-text-property start-pos (1+ start-pos)
'syntax-table
(string-to-syntax "|"))
(put-text-property (1- (point)) (point)
'syntax-table
(string-to-syntax "|"))))
(defun hack--propertize-xhp-class-name ()
"Ensure that : and - in XHP class names are marked as symbol constituents.
Note that the first : is excluded, so :foo:bar is considered to
be punctuation : followed by symbol foo:bar. This ensures we
match XHP usage, which looks like <foo:bar>."
(let ((start (match-beginning 1))
(end (match-end 1)))
(save-excursion
(goto-char (1+ start))
(while (re-search-forward (rx (or ":" "-")) end t)
(put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax "_"))))))
(defconst hack--header-regex
;; <?hh can only occur on the first line. The only thing it may be preceded
;; by is a shebang. It's compulsory, except in .hack files. See hphp.ll.
(rx
(or
buffer-start
(seq "#!" (* not-newline) "\n"))
(group "<?hh")
;; Match // strict if it's present.
;; See full_fidelity_parser.ml which calls FileInfo.parse_mode.
(? (0+ space)
"//"
(0+ space)
(group (or "strict" "partial" "experimental"))
(or space "\n"))))
(eval-and-compile
;; https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
(defconst hack--heredoc-regex
(rx
"<<<"
(group
(or
(+ (or (syntax word) (syntax symbol)))
;; https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc
(seq "'" (+ (or (syntax word) (syntax symbol))) "'")))
"\n"))
(defconst hack--xhp-class-name-regex
;; Based on is_next_xhp_class_name in full_fidelity_lexer.ml.
(rx
(or whitespace line-start)
(group
":"
(+ (or (syntax word) (syntax symbol) ":" "-"))))
"Regex used to match :foo-bar:baz class names.")
;; TODO: Check against next_xhp_element_token in full_fidelity_lexer.ml
(defconst hack-xhp-start-regex
(rx (or
(seq symbol-start "return" symbol-end)
bol
"==>"
"?"
"="
"(")
(* space)
(group "<" (not (any ?< ?\\ ??))))
"The regex used to match the start of an XHP expression."))
(defun hack-font-lock-xhp (limit)
"Search up to LIMIT for an XHP expression.
If we find one, move point to its end, and set match data."
(let ((start-pos nil)
(end-pos nil))
(save-excursion
(while (and (not end-pos)
(re-search-forward hack-xhp-start-regex limit t))
(let* ((ppss-start
(save-excursion (syntax-ppss (match-beginning 1))))
(in-comment (nth 4 ppss-start)))
;; Ignore XHP in comments.
(unless in-comment
(setq start-pos (match-beginning 1))
(hack--forward-parse-xhp start-pos limit t)
(setq end-pos (point))))))
(when end-pos
(set-match-data (list start-pos end-pos))
(goto-char end-pos))))
(defun hack--propertize-lt ()
"Ensure < is not treated a < delimiter in other syntactic contexts."
(let ((start (1- (point))))
(when (or (looking-at "?hh")
;; Ignore comparisons $x <= $y.
(looking-at "=")
;; Ignore left shift operators 1 << 2.
(looking-at "< ")
;; If there's a following space, assume it's 1 < 2.
(looking-at " "))
(put-text-property start (1+ start)
'syntax-table (string-to-syntax ".")))))
(defun hack--join-chars (&rest chars-or-strings)
"Convert CHARS-OR-STRINGS to a single concatenated string."
(let ((strings
(mapcar
(lambda (it) (if (stringp it) it (string it)))
chars-or-strings)))
(apply #'concat strings)))
(defun hack-->-paired-p (pos)
"Return t if the > at POS is a paired delimiter.
E.g. Foo<int> has a paired delimiter, 1 > 2 does not."
(when (> pos (1+ (point-min)))
(let* ((prev-prev-char (char-before (1- pos)))
(prev-char (char-before pos))
(next-char (or (char-after (1+ pos)) ""))
;; We look at a small amount of context to decide what
;; syntax we're looking at.
(context-1-before (hack--join-chars prev-char ?>))
(context-1-after (hack--join-chars ?> next-char))
(context-1-around (hack--join-chars prev-char ?> next-char))
(context-2-before-1-after
(hack--join-chars prev-prev-char prev-char ?> next-char)))
(not
(or
;; foo() |> bar($$)
(string= context-1-before "|>")
;; If there's a preceding space, we assume it's 1 > 2 rather
;; than vec < int > with excess space.
(string= context-1-around " > ")
;; 1 >> 2, first >.
(string= context-1-around " >>")
;; 1 >> 2, second >.
(string= context-2-before-1-after " >> ")
;; $foo->bar and 1<=>2
(string= context-1-before "->")
(string= context-1-before "=>")
;; 1>=2
(string= context-1-after ">=")
;; $x >>= 2
(string= context-1-around " >>"))))))
(defun hack--propertize-gt ()
"Ensure > in -> or => isn't treated as a > delimiter."
(unless (hack-->-paired-p (1- (point)))
(put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax "."))))
(defconst hack--syntax-propertize-function
(syntax-propertize-rules
;; Heredocs, e.g.
;; $x = <<<EOT
;; foo bar
;; EOT;
(hack--heredoc-regex
(0 (ignore (hack--propertize-heredoc))))
(hack--xhp-class-name-regex
(0 (ignore (hack--propertize-xhp-class-name))))
(hack-xhp-start-regex
(0 (ignore (hack--propertize-xhp))))
("<"
(0 (ignore (hack--propertize-lt))))
(">"
(0 (ignore (hack--propertize-gt))))))
(defun hack-font-lock-fallthrough (limit)
"Search for FALLTHROUGH comments."
(let ((case-fold-search nil)
(found-pos nil)
(match-data nil))
;; FALLTHROUGH must start with //, and can have any text afterwards. See
;; full_fidelity_lexer.ml.
(save-excursion
(while (and (not found-pos)
(search-forward "FALLTHROUGH" limit t))
(let* ((ppss (syntax-ppss))
(in-comment (nth 4 ppss))
(comment-start (nth 8 ppss)))
(when in-comment
(save-excursion
(goto-char comment-start)
(when (re-search-forward
(rx point "//" (0+ whitespace) (group "FALLTHROUGH"))
limit t)
(setq found-pos (point))
(setq match-data (match-data))))))))
(when found-pos
(set-match-data match-data)
(goto-char found-pos))))
(defun hack-font-lock-fixme (limit)
"Search for HH_FIXME comments."
(let ((case-fold-search nil)
(found-pos nil)
(match-data nil))
;; HH_FIXME must start with /*, see full_fidelity_lexer.ml. The
;; format is matched by scour_comments in full_fidelity_ast.ml,
;; using, the ignore_error regex defined in that file.
(save-excursion
(while (and (not found-pos)
(search-forward "HH_FIXME" limit t))
(let* ((ppss (syntax-ppss))
(in-comment (nth 4 ppss))
(comment-start (nth 8 ppss)))
(when in-comment
(save-excursion
(goto-char comment-start)
(when (re-search-forward
(rx point "/*" (0+ whitespace)
(group "HH_FIXME" (0+ whitespace) "[" (+ digit) "]"))
limit t)
(setq found-pos (point))
(setq match-data (match-data))))))))
(when found-pos
(set-match-data match-data)
(goto-char found-pos))))
(defun hack-font-lock-ignore-error (limit)
"Search for HH_IGNORE_ERROR comments."
(let ((case-fold-search nil)
(found-pos nil)
(match-data nil))
;; HH_IGNORE_ERROR must start with /*, see full_fidelity_lexer.ml. The
;; format is matched by scour_comments in full_fidelity_ast.ml,
;; using, the ignore_error regex defined in that file.
(save-excursion
(while (and (not found-pos)
(search-forward "HH_IGNORE_ERROR" limit t))
(let* ((ppss (syntax-ppss))
(in-comment (nth 4 ppss))
(comment-start (nth 8 ppss)))
(when in-comment
(save-excursion
(goto-char comment-start)
(when (re-search-forward
(rx point "/*" (0+ whitespace)
(group "HH_IGNORE_ERROR" (0+ whitespace) "[" (+ digit) "]"))
limit t)
(setq found-pos (point))
(setq match-data (match-data))))))))
(when found-pos
(set-match-data match-data)
(goto-char found-pos))))
(defun hack-font-lock-interpolate (limit)
"Search for $foo string interpolation."
(let ((pattern
(rx (not (any "\\"))
(group
(or
(seq
;; $foo
"$" (+ (or (syntax word) (syntax symbol))) symbol-end
(0+ (or
;; $foo->bar
(seq "->" (+ (or (syntax word) (syntax symbol))) symbol-end)
;; $foo[123]
(seq "[" (+ (or (syntax word) (syntax symbol))) symbol-end "]"))))
;; ${foo}
(seq "${" (+ (or (syntax word) (syntax symbol))) symbol-end "}")))))
res match-data)
(save-match-data
;; Search forward for $foo and terminate on the first
;; instance we find that's inside a sring.
(while (and
(not res)
(re-search-forward pattern limit t))
(let* ((ppss (syntax-ppss))
(in-string-p (nth 3 ppss))
(string-delimiter-pos (nth 8 ppss))
(string-delimiter
(when in-string-p (char-after string-delimiter-pos)))
(interpolation-p in-string-p))
(cond
;; Interpolation does not apply in single-quoted strings.
((eq string-delimiter ?')
(setq interpolation-p nil))
;; We can interpolate in <<<FOO, but not in <<<'FOO'
((eq string-delimiter ?<)
(save-excursion
(goto-char string-delimiter-pos)
(save-match-data
(re-search-forward (rx (+ "<")))
(when (looking-at (rx "'"))
(setq interpolation-p nil))))))
(when interpolation-p
(setq res (point))
;; Set match data to the group we matched.
(setq match-data (list (match-beginning 1) (match-end 1)))))))
;; Set match data and return point so we highlight this
;; instance.
(when res
(set-match-data match-data)
res)))
(defun hack--propertize->-in-xhp-interpolation (start end xhp-start)
"Apply syntax properties to any interpolated occurrences of -> between START and END."
(save-excursion
(goto-char start)
(while (search-forward ">" end t)
(when (and
;; We deliberately check for interpolation *before*
;; the >. This ensures that we don't get confused if
;; we still think > is a paired delimiter.
(hack--in-xhp-interpolation-p (1- (point)) xhp-start)
(not (hack-->-paired-p (1- (point)))))
;; Ensure -> is just punctuation inside XHP interpolation in tags.
(put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax "."))))))
(defun hack--propertize-quotes-in-xhp-interpolation (start end xhp-start)
"Apply syntax properties to any interpolated occurrences of ' or \" between START and END."
(save-excursion
(goto-char start)
(while (re-search-forward (rx (or "'" "\"")) end t)
(unless (hack--in-xhp-interpolation-p (point) xhp-start)
(put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax "."))))))
(defun hack--forward-parse-xhp (start-pos limit &optional propertize-tags)
"Move point past the XHP expression beginning at START-POS.
If PROPERTIZE-TAGS is nil, apply syntax properties to text.
If PROPERTIZE-TAGS is non-nil, apply `hack-xhp-tag' to tag names."
(let ((tags nil)
tag-start
prev-tag-end)
(goto-char start-pos)
(catch 'done
;; Whilst we're inside XHP, and there are still more
;; tags in the buffer.
(while t
;; Find the next tag start.
(unless (search-forward "<" limit t)
;; Can't find any more tags.
(throw 'done t))
(setq tag-start (1- (point)))
(when (and prev-tag-end (not propertize-tags))
;; Treat " and ' as punctuation inside XHP text content:
;; <p>"</p>
;; but not in properties or interpolation:
;; <p id="foo">{func("baz")}</p>
(hack--propertize-quotes-in-xhp-interpolation prev-tag-end (point) start-pos)
;; Treat -> as punctuation in interpolation.
(hack--propertize->-in-xhp-interpolation prev-tag-end (point) start-pos))
(let ((close-p (looking-at-p "/"))
tag-name tag-name-start tag-name-end
self-closing-p)
(when close-p
(forward-char 1))
;; Get the name of the current tag.
(unless
(re-search-forward
(rx (+ (or (syntax word) (syntax symbol) ":" "-"))) nil t)
;; Incomplete XHP tag, e.g. the user has just written "<".
(throw 'done t))
(setq tag-name (match-string 0))
(setq tag-name-start (match-beginning 0))
(setq tag-name-end (match-end 0))
(if propertize-tags
(add-face-text-property tag-name-start tag-name-end 'hack-xhp-tag)
;; Ensure : and - are symbol consituents on tag names.
(goto-char tag-name-start)
(while (re-search-forward (rx (or ":" "-")) tag-name-end t)
(put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax "_"))))
;; Find the closing > of this XHP tag, ignoring interpolation.
(let (tag-end)
(while (and (not tag-end)
(search-forward ">" limit t))
(unless (and
(hack--in-xhp-interpolation-p (1- (point)) start-pos)
(not (hack-->-paired-p (1- (point)))))
;; Not inside interpolation, so this > is the tag end.
(setq tag-end (point))))
(if tag-end
;; Ensure -> is just punctuation inside XHP interpolation in tags.
(when (null propertize-tags)
(hack--propertize->-in-xhp-interpolation tag-start tag-end start-pos))
;; Can't find the matching close angle bracket, so the XHP
;; expression is incomplete.
(throw 'done t)))
(save-excursion
(backward-char 2)
(when (looking-at "/>")
(setq self-closing-p t)))
(cond
(self-closing-p
;; A self-closing tag doesn't need pushing to the stack.
nil)
((and close-p (string= tag-name (car tags)))
;; A balanced closing tag.
(pop tags))
(close-p
;; An unbalanced close tag, we were expecting something
;; else. Assume this is the end of the XHP section.
(throw 'done t))
(t
;; An open tag.
(push tag-name tags)))
(unless tags
;; Reach the close of the initial open XHP tag.
(throw 'done t))
(setq prev-tag-end (point)))))
(put-text-property start-pos (point)
'hack-xhp-expression start-pos)))
(defun hack-font-lock-interpolate-complex (limit)
"Search for {$foo} string interpolation."
(let (res start)
(while (and
(not res)
(search-forward "{$" limit t))
(let* ((ppss (syntax-ppss))
(in-string-p (nth 3 ppss))
(string-delimiter-pos (nth 8 ppss))
(string-delimiter
(when in-string-p (char-after string-delimiter-pos)))
(interpolation-p in-string-p))
(cond
;; Interpolation does not apply in single-quoted strings.
((eq string-delimiter ?')
(setq interpolation-p nil))
;; We can interpolate in <<<FOO, but not in <<<'FOO'
((eq string-delimiter ?<)
(save-excursion
(goto-char string-delimiter-pos)
(save-match-data
(re-search-forward (rx (+ "<")))
(when (looking-at (rx "'"))
(setq interpolation-p nil))))))
(when interpolation-p
(setq start (match-beginning 0))
(let ((restart-pos (match-end 0)))
;; Search forward for the } that matches the opening {.
(while (and (not res) (search-forward "}" limit t))
(let ((end-pos (point)))
(save-excursion
(when (and (ignore-errors (backward-list 1))
(= start (point)))
(setq res end-pos)))))
(unless res
(goto-char restart-pos))))))
;; Set match data and return point so we highlight this
;; instance.
(when res
(set-match-data (list start res))
res)))
(defconst hack--keyword-regex
;; Keywords, based on hphp.ll.
;; We don't highlight endforeach etc, as they're syntax errors.
;; From full_fidelity_lexer.ml.
(regexp-opt
'(;; This is the list of keywords from full_fidelity_lexer.ml, but
;; removing types (boolean etc) and constants (true, false, null).
"abstract" "as" "break"
"case" "catch" "class" "clone" "const" "continue" "declare" "default"
"die" "do" "echo" "else" "elseif" "empty" "enddeclare" "endfor"
"endforeach" "endif" "endswitch" "endwhile" "eval" "exit" "extends"
"final" "finally" "for" "foreach" "function" "global" "goto" "if"
"implements" "include" "include_once" "insteadof"
"interface" "is" "isset" "list" "nameof" "namespace" "new" "parent"
"print" "private" "protected" "public" "internal"
"require" "require_once"
"return" "self" "static" "switch" "throw" "trait"
"try" "unset" "use" "var" "while"
"yield"
"inout" "using"
;; Contextual keywords.
"async"
"await"
"concurrent"
"enum"
"newtype"
"readonly"
"shape"
"super"
"tuple"
"type"
"where"
;; These contextual keywords are also used for literals, so highlight them as keywords.
"darray"
"dict"
"keyset"
"varray"
"vec"
;; XHP keywords
"attribute"
"category"
"children"
"required"
;; Highlight a lambda function as a keyword to make it clear,
;; even though users can't shadow this anyway.
"==>"
;; Treat self:: and parent:: as keywords.
"self"
"parent")
'symbols))
(defconst hack--type-regex
(rx
(or symbol-start whitespace "<")
(? "?")
(group
(or
;; Built-in classes, based on Classes in
;; naming_special_names.ml, excluding self/parent (which we've
;; treated as keywords above).
"stdClass"
"classname"
"typename"
;; Built-in types, based on Typehints in naming_special_names.ml
;; and as_case_insensitive_keyword in full_fidelity_lexer.ml.
"arraykey"
"bool"
"boolean"
"callable"
"double"
"dynamic"
"float"
"int"
"integer"
"mixed"
"nonnull"
"noreturn"
"num"
"null"
"nothing"
"object"
"real"
"resource"
"string"
"this"
"varray_or_darray"
"void"
;; Placeholder types, e.g. in vec<_>.
"_"
;; PHP built-in classes that don't start with an upper case character
;; https://docs.hhvm.com/php/reference/
"finfo"
"libXMLError"
"mysqli"
"mysqli_driver"
"mysqli_result"
"mysqli_stmt"
"mysqli_warning"
"php_user_filter"
;; User-defined type.
(seq
(0+ "_")
(any upper)
(* (or (syntax word) (syntax symbol))))
;; XHP type, based on is_next_xhp_class_name in full_fidelity_lexer.ml.
(seq
":"
(+ (or (syntax word) (syntax symbol) ":" "-")))))
symbol-end))
(defconst hack--built-in-fun-regex
(rx
(or line-start whitespace)
symbol-start
(group
(or
;; https://docs.hhvm.com/hack/reference/function/ HH\foo functions
"array_key_cast" "asio_get_current_context_idx" "asio_get_running" "asio_get_running_in_context" "autoload_set_paths"
"class_meth" "clear_instance_memoization" "clear_lsb_memoization" "clear_static_memoization" "could_include"
"curl_create_pool" "curl_destroy_pool" "curl_init_pooled" "curl_list_pools" "darray"
"deferred_errors" "disable_code_coverage_with_frequency" "enable_legacy_behavior" "execution_context" "ext_factparse_version"
"ext_watchman_version" "facts_parse" "ffp_parse_string" "ffp_parse_string_native" "fun"
"get_headers_secure" "heapgraph_create" "heapgraph_dfs_edges" "heapgraph_dfs_nodes" "heapgraph_edge"
"heapgraph_foreach_edge" "heapgraph_foreach_node" "heapgraph_foreach_root" "heapgraph_foreach_root_node" "heapgraph_node"
"heapgraph_node_in_edges" "heapgraph_node_out_edges" "heapgraph_stats" "heapgraph_version" "idx"
"inst_meth" "invariant" "invariant_callback_register" "invariant_violation" "is_any_array"
"is_darray" "is_dict" "is_keyset" "is_list_like" "is_varray"
"is_vec" "meth_caller" "non_crypto_md5_lower" "non_crypto_md5_upper" "object_prop_array"
"objprof_get_data" "objprof_get_paths" "objprof_get_strings" "serialize_memoize_param" "serialize_with_options"
"server_health_level" "server_is_prepared_to_stop" "server_is_stopping" "server_process_start_time" "server_uptime"
"server_warmup_status" "server_warmup_status_monotonic" "set_frame_metadata" "set_mem_threshold_callback" "set_soft_late_init_default"
"thread_mark_stack" "thread_memory_stats" "varray" "watchman_check_sub" "watchman_run"
"watchman_subscribe" "watchman_sync_sub" "watchman_unsubscribe" "xenon_get_and_clear_missed_sample_count" "xenon_get_and_clear_samples"
"xenon_get_data" "xenon_get_is_profiled_request"
;; https://docs.hhvm.com/hack/reference/function/ global functions
"call_user_func_array" "curl_multi_await" "fb_autoload_map" "fb_compact_serialize" "fb_compact_unserialize"
"fb_curl_getopt" "fb_curl_multi_fdset" "fb_disable_code_coverage" "fb_enable_code_coverage" "fb_get_code_coverage"
"fb_get_last_flush_size" "fb_htmlspecialchars" "fb_intercept" "fb_lazy_lstat" "fb_lazy_realpath"
"fb_output_compression" "fb_rename_function" "fb_serialize" "fb_set_exit_callback" "fb_setprofile"
"fb_unserialize" "fb_utf8_strlen" "fb_utf8_strlen_deprecated" "fb_utf8_substr" "fb_utf8ize"
"forward_static_call_array" "furchash_hphp_ext" "furchash_hphp_ext_supported" "get_class_constants" "get_http_request_size"
"hphp_array_idx" "hphp_clear_hardware_events" "hphp_clear_unflushed" "hphp_crash_log" "hphp_create_continuation"
"hphp_create_object" "hphp_create_object_without_constructor" "hphp_current_ref" "hphp_debug_backtrace_hash" "hphp_debug_break"
"hphp_debug_caller_info" "hphp_debug_session_auth" "hphp_debugger_attached" "hphp_directoryiterator___construct" "hphp_directoryiterator___tostring"
"hphp_directoryiterator_current" "hphp_directoryiterator_isdot" "hphp_directoryiterator_key" "hphp_directoryiterator_next" "hphp_directoryiterator_rewind"
"hphp_directoryiterator_seek" "hphp_directoryiterator_valid" "hphp_get_class_constant" "hphp_get_extension_info" "hphp_get_hardware_counters"
"hphp_get_iostatus" "hphp_get_iterator" "hphp_get_mutable_iterator" "hphp_get_property" "hphp_get_static_property"
"hphp_get_stats" "hphp_get_status" "hphp_get_this" "hphp_get_thread_id" "hphp_get_timers"
"hphp_gettid" "hphp_instanceof" "hphp_instruction_counter" "hphp_invoke" "hphp_invoke_method"
"hphp_memory_get_interval_peak_usage" "hphp_memory_heap_capacity" "hphp_memory_heap_usage" "hphp_memory_start_interval" "hphp_memory_stop_interval"
"hphp_murmurhash" "hphp_object_pointer" "hphp_output_global_state" "hphp_process_abort" "hphp_recursivedirectoryiterator___construct"
"hphp_recursivedirectoryiterator___tostring" "hphp_recursivedirectoryiterator_current" "hphp_recursivedirectoryiterator_getchildren" "hphp_recursivedirectoryiterator_getsubpath" "hphp_recursivedirectoryiterator_getsubpathname"
"hphp_recursivedirectoryiterator_haschildren" "hphp_recursivedirectoryiterator_key" "hphp_recursivedirectoryiterator_next" "hphp_recursivedirectoryiterator_rewind" "hphp_recursivedirectoryiterator_seek"
"hphp_recursivedirectoryiterator_valid" "hphp_recursiveiteratoriterator___construct" "hphp_recursiveiteratoriterator_current" "hphp_recursiveiteratoriterator_getinneriterator" "hphp_recursiveiteratoriterator_key"
"hphp_recursiveiteratoriterator_next" "hphp_recursiveiteratoriterator_rewind" "hphp_recursiveiteratoriterator_valid" "hphp_scalar_typehints_enabled" "hphp_set_error_page"
"hphp_set_hardware_events" "hphp_set_iostatus_address" "hphp_set_property" "hphp_set_static_property" "hphp_stats"
"hphp_thread_type" "hphp_throw_fatal_error" "hphp_to_string" "hphpd_auth_token" "hphpd_break"
"lz4hccompress" "memory_get_allocation" "mysql_async_connect_completed" "mysql_async_connect_start" "mysql_async_fetch_array"
"mysql_async_query_completed" "mysql_async_query_result" "mysql_async_query_start" "mysql_async_status" "mysql_async_wait_actionable"
"mysql_connect_with_db" "mysql_more_results" "mysql_multi_query" "mysql_next_result" "mysql_pconnect_with_db"
"mysql_set_timeout" "mysql_warning_count" "pagelet_server_flush" "pagelet_server_is_done" "pagelet_server_is_enabled"
"pagelet_server_task_result" "pagelet_server_task_start" "pagelet_server_task_status" "pagelet_server_tasks_started" "register_postsend_function"
"sncompress" "stream_await" "xbox_get_thread_time" "xbox_get_thread_timeout" "xbox_post_message"
"xbox_process_call_message" "xbox_schedule_thread_reset" "xbox_send_message" "xbox_set_thread_timeout" "xbox_task_result"
"xbox_task_start" "xbox_task_status" "xhprof_disable" "xhprof_enable" "xhprof_frame_begin"
"xhprof_frame_end" "xhprof_network_disable" "xhprof_network_enable" "xhprof_sample_disable" "xhprof_sample_enable"
;; https://docs.hhvm.com/php/reference/
;; Contains some duplicates with the above.
"abs" "acos" "acosh" "addcslashes" "addslashes"
"apc_add" "apc_cache_info" "apc_cas" "apc_clear_cache" "apc_dec"
"apc_delete" "apc_exists" "apc_fetch" "apc_inc" "apc_sma_info"
"apc_store" "array_change_key_case" "array_chunk" "array_column" "array_combine"
"array_count_values" "array_diff" "array_diff_assoc" "array_diff_key" "array_diff_uassoc"
"array_diff_ukey" "array_fill" "array_fill_keys" "array_filter" "array_flip"
"array_intersect" "array_intersect_assoc" "array_intersect_key" "array_intersect_uassoc" "array_intersect_ukey"
"array_key_exists" "array_keys" "array_map" "array_merge" "array_merge_recursive"
"array_multisort" "array_pad" "array_pop" "array_product" "array_push"
"array_rand" "array_reduce" "array_replace" "array_replace_recursive" "array_reverse"
"array_search" "array_shift" "array_slice" "array_splice" "array_sum"
"array_udiff" "array_udiff_assoc" "array_udiff_uassoc" "array_uintersect" "array_uintersect_assoc"
"array_uintersect_uassoc" "array_unique" "array_unshift" "array_values" "array_walk"
"array_walk_recursive" "arsort" "asin" "asinh" "asort"
"assert" "assert_options" "atan" "atan2" "atanh"
"base64_decode" "base64_encode" "base_convert" "basename" "bcadd"
"bccomp" "bcdiv" "bcmod" "bcmul" "bcpow"
"bcpowmod" "bcscale" "bcsqrt" "bcsub" "bin2hex"
"bind_textdomain_codeset" "bindec" "bindtextdomain" "boolval" "bzclose"
"bzcompress" "bzdecompress" "bzerrno" "bzerror" "bzerrstr"
"bzflush" "bzopen" "bzread" "bzwrite" "call_user_func"
"call_user_func_array" "call_user_method" "call_user_method_array" "ceil" "chdir"
"checkdate" "checkdnsrr" "chgrp" "chmod" "chop"
"chown" "chr" "chroot" "chunk_split" "class_alias"
"class_exists" "class_implements" "class_parents" "class_uses" "clearstatcache"
"closedir" "closelog" "compact" "connection_aborted" "connection_status"
"constant" "convert_cyr_string" "convert_uudecode" "convert_uuencode" "copy"
"cos" "cosh" "count" "count_chars" "crc32"
"crypt" "ctype_alnum" "ctype_alpha" "ctype_cntrl" "ctype_digit"
"ctype_graph" "ctype_lower" "ctype_print" "ctype_punct" "ctype_space"
"ctype_upper" "ctype_xdigit" "curl_close" "curl_copy_handle" "curl_errno"
"curl_error" "curl_exec" "curl_file_create" "curl_getinfo" "curl_init"
"curl_multi_add_handle" "curl_multi_close" "curl_multi_exec" "curl_multi_getcontent" "curl_multi_info_read"
"curl_multi_init" "curl_multi_remove_handle" "curl_multi_select" "curl_multi_setopt" "curl_multi_strerror"
"curl_reset" "curl_setopt" "curl_setopt_array" "curl_share_close" "curl_share_init"
"curl_share_setopt" "curl_strerror" "curl_version" "current" "date"
"date_add" "date_create" "date_create_from_format" "date_create_immutable" "date_date_set"
"date_default_timezone_get" "date_default_timezone_set" "date_diff" "date_format" "date_get_last_errors"
"date_interval_create_from_date_string" "date_interval_format" "date_isodate_set" "date_modify" "date_offset_get"
"date_parse" "date_parse_from_format" "date_sub" "date_sun_info" "date_sunrise"
"date_sunset" "date_time_set" "date_timestamp_get" "date_timestamp_set" "date_timezone_get"
"date_timezone_set" "dcgettext" "dcngettext" "debug_backtrace" "debug_print_backtrace"
"debug_zval_dump" "decbin" "dechex" "decoct"
"define_syslog_variables" "defined" "deg2rad" "dgettext" "dir"
"dirname" "disk_free_space" "disk_total_space" "diskfreespace" "dl"
"dngettext" "dns_check_record" "dns_get_mx" "dns_get_record" "dom_import_simplexml"
"doubleval" "each" "end" "ereg" "ereg_replace"
"eregi" "eregi_replace" "error_get_last" "error_log" "error_reporting"
"escapeshellarg" "escapeshellcmd" "exec" "exif_imagetype" "exif_read_data"
"exif_tagname" "exif_thumbnail" "exp" "explode" "expm1"
"extension_loaded" "ezmlm_hash" "fclose" "feof" "fflush"
"fgetc" "fgetcsv" "fgets" "fgetss" "file"
"file_exists" "file_get_contents" "file_put_contents" "fileatime" "filectime"
"filegroup" "fileinode" "filemtime" "fileowner" "fileperms"
"filesize" "filetype" "filter_has_var" "filter_id" "filter_input"
"filter_input_array" "filter_list" "filter_var" "filter_var_array" "finfo_buffer"
"finfo_close" "finfo_file" "finfo_open" "finfo_set_flags" "floatval"
"flock" "floor" "flush" "fmod" "fnmatch"
"fopen" "forward_static_call" "forward_static_call_array" "fpassthru" "fprintf"
"fputcsv" "fputs" "fread" "fscanf" "fseek"
"fsockopen" "fstat" "ftell" "ftok" "ftruncate"
"func_get_arg" "func_get_args" "func_num_args" "function_exists" "fwrite"
"gc_collect_cycles" "gc_disable" "gc_enable" "gc_enabled" "gc_mem_caches"
"gd_info" "get_called_class" "get_cfg_var" "get_class" "get_class_methods"
"get_class_vars" "get_current_user" "get_declared_classes" "get_declared_interfaces" "get_declared_traits"
"get_defined_constants" "get_defined_functions" "get_defined_vars" "get_extension_funcs" "get_headers"
"get_html_translation_table" "get_include_path" "get_included_files" "get_loaded_extensions" "get_magic_quotes_gpc"
"get_magic_quotes_runtime" "get_meta_tags" "get_object_vars" "get_parent_class" "get_required_files"
"get_resource_type" "getcwd" "getdate" "getenv" "gethostbyaddr"
"gethostbyname" "gethostbynamel" "gethostname" "getimagesize" "getimagesizefromstring"
"getlastmod" "getmxrr" "getmygid" "getmyinode" "getmypid"
"getmyuid" "getopt" "getprotobyname" "getprotobynumber" "getrandmax"
"getrusage" "getservbyname" "getservbyport" "gettext" "gettimeofday"
"gettype" "glob" "gmdate" "gmmktime" "gmp_abs"
"gmp_add" "gmp_and" "gmp_clrbit" "gmp_cmp" "gmp_com"
"gmp_div" "gmp_div_q" "gmp_div_qr" "gmp_div_r" "gmp_divexact"
"gmp_fact" "gmp_gcd" "gmp_gcdext" "gmp_hamdist" "gmp_init"
"gmp_intval" "gmp_invert" "gmp_jacobi" "gmp_legendre" "gmp_mod"
"gmp_mul" "gmp_neg" "gmp_nextprime" "gmp_or" "gmp_perfect_square"
"gmp_popcount" "gmp_pow" "gmp_powm" "gmp_prob_prime" "gmp_random"
"gmp_root" "gmp_rootrem" "gmp_scan0" "gmp_scan1" "gmp_setbit"
"gmp_sign" "gmp_sqrt" "gmp_sqrtrem" "gmp_strval" "gmp_sub"
"gmp_testbit" "gmp_xor" "gmstrftime" "grapheme_extract" "grapheme_stripos"
"grapheme_stristr" "grapheme_strlen" "grapheme_strpos" "grapheme_strripos" "grapheme_strrpos"
"grapheme_strstr" "grapheme_substr" "gzclose" "gzcompress" "gzdecode"
"gzdeflate" "gzencode" "gzeof" "gzfile" "gzgetc"
"gzgets" "gzgetss" "gzinflate" "gzopen" "gzpassthru"
"gzputs" "gzread" "gzrewind" "gzseek" "gztell"
"gzuncompress" "gzwrite" "hash" "hash_algos" "hash_copy"
"hash_equals" "hash_file" "hash_final" "hash_hmac" "hash_hmac_file"
"hash_init" "hash_pbkdf2" "hash_update" "hash_update_file" "hash_update_stream"
"header" "header_register_callback" "header_remove" "headers_list" "headers_sent"
"hebrev" "hebrevc" "hex2bin" "hexdec" "html_entity_decode"
"htmlentities" "htmlspecialchars" "htmlspecialchars_decode" "http_build_query" "http_response_code"
"hypot" "iconv" "iconv_get_encoding" "iconv_mime_decode" "iconv_mime_decode_headers"
"iconv_mime_encode" "iconv_set_encoding" "iconv_strlen" "iconv_strpos" "iconv_strrpos"
"iconv_substr" "idate" "idn_to_ascii" "idn_to_utf8" "ignore_user_abort"
"image2wbmp" "image_type_to_extension" "image_type_to_mime_type" "imageaffine" "imageaffinematrixconcat"
"imageaffinematrixget" "imagealphablending" "imageantialias" "imagearc" "imagechar"
"imagecharup" "imagecolorallocate" "imagecolorallocatealpha" "imagecolorat" "imagecolorclosest"
"imagecolorclosestalpha" "imagecolorclosesthwb" "imagecolordeallocate" "imagecolorexact" "imagecolorexactalpha"
"imagecolormatch" "imagecolorresolve" "imagecolorresolvealpha" "imagecolorset" "imagecolorsforindex"
"imagecolorstotal" "imagecolortransparent" "imageconvolution" "imagecopy" "imagecopymerge"
"imagecopymergegray" "imagecopyresampled" "imagecopyresized" "imagecreate" "imagecreatefromgd"
"imagecreatefromgd2" "imagecreatefromgd2part" "imagecreatefromgif" "imagecreatefromjpeg" "imagecreatefrompng"
"imagecreatefromstring" "imagecreatefromwbmp" "imagecreatefromwebp" "imagecreatefromxbm" "imagecreatetruecolor"
"imagecrop" "imagecropauto" "imagedashedline" "imagedestroy" "imageellipse"
"imagefill" "imagefilledarc" "imagefilledellipse" "imagefilledpolygon" "imagefilledrectangle"
"imagefilltoborder" "imagefilter" "imageflip" "imagefontheight" "imagefontwidth"
"imageftbbox" "imagefttext" "imagegammacorrect" "imagegd" "imagegd2"
"imagegif" "imageinterlace" "imageistruecolor" "imagejpeg" "imagelayereffect"
"imageline" "imageloadfont" "imagepalettecopy" "imagepng" "imagepolygon"
"imagerectangle" "imagerotate" "imagesavealpha" "imagescale" "imagesetbrush"
"imagesetinterpolation" "imagesetpixel" "imagesetstyle" "imagesetthickness" "imagesettile"
"imagestring" "imagestringup" "imagesx" "imagesy" "imagetruecolortopalette"
"imagettfbbox" "imagettftext" "imagetypes" "imagewbmp" "imagewebp"
"imap_8bit" "imap_alerts" "imap_base64" "imap_binary" "imap_body"
"imap_bodystruct" "imap_check" "imap_clearflag_full" "imap_close" "imap_createmailbox"
"imap_delete" "imap_deletemailbox" "imap_errors" "imap_expunge" "imap_fetch_overview"
"imap_fetchbody" "imap_fetchheader" "imap_fetchstructure" "imap_gc" "imap_header"
"imap_headerinfo" "imap_last_error" "imap_list" "imap_listmailbox" "imap_mail"
"imap_mail_copy" "imap_mail_move" "imap_mailboxmsginfo" "imap_msgno" "imap_num_msg"
"imap_num_recent" "imap_open" "imap_ping" "imap_qprint" "imap_renamemailbox"
"imap_reopen" "imap_search" "imap_setflag_full" "imap_status" "imap_subscribe"
"imap_timeout" "imap_uid" "imap_undelete" "imap_unsubscribe" "imap_utf8"
"implode" "import_request_variables" "in_array" "inet_ntop" "inet_pton"
"ini_alter" "ini_get" "ini_get_all" "ini_restore" "ini_set"
"intdiv" "interface_exists" "intl_error_name" "intl_get_error_code" "intl_get_error_message"
"intl_is_failure" "intval" "ip2long" "iptcembed" "iptcparse"
"is_a" "is_array" "is_bool" "is_callable" "is_dir"
"is_double" "is_executable" "is_file" "is_finite" "is_float"
"is_infinite" "is_int" "is_integer" "is_link" "is_long"
"is_nan" "is_null" "is_numeric" "is_object" "is_readable"
"is_real" "is_resource" "is_scalar" "is_soap_fault" "is_string"
"is_subclass_of" "is_uploaded_file" "is_writable" "is_writeable" "iterator_apply"
"iterator_count" "iterator_to_array" "join" "jpeg2wbmp" "json_decode"
"json_encode" "json_last_error" "json_last_error_msg" "key" "key_exists"
"krsort" "ksort" "lcfirst" "lcg_value" "lchgrp"
"lchown" "ldap_add" "ldap_bind" "ldap_close" "ldap_compare"
"ldap_connect" "ldap_control_paged_result" "ldap_control_paged_result_response" "ldap_count_entries" "ldap_delete"
"ldap_dn2ufn" "ldap_err2str" "ldap_errno" "ldap_error" "ldap_escape"
"ldap_explode_dn" "ldap_first_attribute" "ldap_first_entry" "ldap_first_reference" "ldap_free_result"
"ldap_get_attributes" "ldap_get_dn" "ldap_get_entries" "ldap_get_option" "ldap_get_values"
"ldap_get_values_len" "ldap_list" "ldap_mod_add" "ldap_mod_del" "ldap_mod_replace"
"ldap_modify" "ldap_modify_batch" "ldap_next_attribute" "ldap_next_entry" "ldap_next_reference"
"ldap_parse_reference" "ldap_parse_result" "ldap_read" "ldap_rename" "ldap_search"
"ldap_set_option" "ldap_set_rebind_proc" "ldap_sort" "ldap_start_tls" "ldap_unbind"
"levenshtein" "libxml_clear_errors" "libxml_disable_entity_loader" "libxml_get_errors" "libxml_get_last_error"
"libxml_set_streams_context" "libxml_use_internal_errors" "link" "linkinfo" "localeconv"
"localtime" "log" "log10" "log1p" "long2ip"
"lstat" "ltrim" "magic_quotes_runtime" "mail" "mailparse_determine_best_xfer_encoding"
"mailparse_msg_create" "mailparse_msg_extract_part" "mailparse_msg_extract_part_file" "mailparse_msg_extract_whole_part_file" "mailparse_msg_free"
"mailparse_msg_get_part" "mailparse_msg_get_part_data" "mailparse_msg_get_structure" "mailparse_msg_parse" "mailparse_msg_parse_file"
"mailparse_rfc822_parse_addresses" "mailparse_stream_encode" "mailparse_uudecode_all" "max" "mb_check_encoding"
"mb_convert_case" "mb_convert_encoding" "mb_convert_kana" "mb_convert_variables" "mb_decode_mimeheader"
"mb_decode_numericentity" "mb_detect_encoding" "mb_detect_order" "mb_encode_mimeheader" "mb_encode_numericentity"
"mb_encoding_aliases" "mb_ereg" "mb_ereg_match" "mb_ereg_replace" "mb_ereg_search"
"mb_ereg_search_getpos" "mb_ereg_search_getregs" "mb_ereg_search_init" "mb_ereg_search_pos" "mb_ereg_search_regs"
"mb_ereg_search_setpos" "mb_eregi" "mb_eregi_replace" "mb_get_info" "mb_http_input"
"mb_http_output" "mb_internal_encoding" "mb_language" "mb_list_encodings" "mb_output_handler"
"mb_parse_str" "mb_preferred_mime_name" "mb_regex_encoding" "mb_regex_set_options" "mb_send_mail"
"mb_split" "mb_strcut" "mb_strimwidth" "mb_stripos" "mb_stristr"
"mb_strlen" "mb_strpos" "mb_strrchr" "mb_strrichr" "mb_strripos"
"mb_strrpos" "mb_strstr" "mb_strtolower" "mb_strtoupper" "mb_strwidth"
"mb_substitute_character" "mb_substr" "mb_substr_count" "mcrypt_cbc" "mcrypt_cfb"
"mcrypt_create_iv" "mcrypt_decrypt" "mcrypt_ecb" "mcrypt_enc_get_algorithms_name" "mcrypt_enc_get_block_size"
"mcrypt_enc_get_iv_size" "mcrypt_enc_get_key_size" "mcrypt_enc_get_modes_name" "mcrypt_enc_get_supported_key_sizes" "mcrypt_enc_is_block_algorithm"
"mcrypt_enc_is_block_algorithm_mode" "mcrypt_enc_is_block_mode" "mcrypt_enc_self_test" "mcrypt_encrypt" "mcrypt_generic"
"mcrypt_generic_deinit" "mcrypt_generic_end" "mcrypt_generic_init" "mcrypt_get_block_size" "mcrypt_get_cipher_name"
"mcrypt_get_iv_size" "mcrypt_get_key_size" "mcrypt_list_algorithms" "mcrypt_list_modes" "mcrypt_module_close"
"mcrypt_module_get_algo_block_size" "mcrypt_module_get_algo_key_size" "mcrypt_module_get_supported_key_sizes" "mcrypt_module_is_block_algorithm" "mcrypt_module_is_block_algorithm_mode"
"mcrypt_module_is_block_mode" "mcrypt_module_open" "mcrypt_module_self_test" "mcrypt_ofb" "md5"
"md5_file" "mdecrypt_generic" "memory_get_peak_usage" "memory_get_usage" "metaphone"
"method_exists" "microtime" "mime_content_type" "min" "mkdir"
"mktime" "money_format" "move_uploaded_file" "msg_get_queue" "msg_queue_exists"
"msg_receive" "msg_remove_queue" "msg_send" "msg_set_queue" "msg_stat_queue"
"mt_getrandmax" "mt_rand" "mt_srand" "mysql_affected_rows" "mysql_client_encoding"
"mysql_close" "mysql_connect" "mysql_create_db" "mysql_data_seek" "mysql_db_name"
"mysql_db_query" "mysql_drop_db" "mysql_errno" "mysql_error" "mysql_escape_string"
"mysql_fetch_array" "mysql_fetch_assoc" "mysql_fetch_field" "mysql_fetch_lengths" "mysql_fetch_object"
"mysql_fetch_row" "mysql_field_flags" "mysql_field_len" "mysql_field_name" "mysql_field_seek"
"mysql_field_table" "mysql_field_type" "mysql_free_result" "mysql_get_client_info" "mysql_get_host_info"
"mysql_get_proto_info" "mysql_get_server_info" "mysql_info" "mysql_insert_id" "mysql_list_dbs"
"mysql_list_fields" "mysql_list_processes" "mysql_list_tables" "mysql_num_fields" "mysql_num_rows"
"mysql_pconnect" "mysql_ping" "mysql_query" "mysql_real_escape_string" "mysql_result"
"mysql_select_db" "mysql_set_charset" "mysql_stat" "mysql_tablename" "mysql_thread_id"
"mysql_unbuffered_query" "mysqli_connect" "mysqli_escape_string" "mysqli_report" "natcasesort"
"natsort" "next" "ngettext" "nl2br" "nl_langinfo"
"number_format" "ob_clean" "ob_end_clean" "ob_end_flush" "ob_flush"
"ob_get_clean" "ob_get_contents" "ob_get_flush" "ob_get_length" "ob_get_level"
"ob_get_status" "ob_iconv_handler" "ob_implicit_flush" "ob_list_handlers" "ob_start"
"octdec" "opendir" "openlog" "openssl_cipher_iv_length" "openssl_csr_export"
"openssl_csr_export_to_file" "openssl_csr_get_public_key" "openssl_csr_get_subject" "openssl_csr_new" "openssl_csr_sign"
"openssl_decrypt" "openssl_digest" "openssl_encrypt" "openssl_error_string" "openssl_free_key"
"openssl_get_cipher_methods" "openssl_get_curve_names" "openssl_get_md_methods" "openssl_get_privatekey" "openssl_get_publickey"
"openssl_open" "openssl_pkcs12_export" "openssl_pkcs12_export_to_file" "openssl_pkcs12_read" "openssl_pkcs7_decrypt"
"openssl_pkcs7_encrypt" "openssl_pkcs7_sign" "openssl_pkcs7_verify" "openssl_pkey_export" "openssl_pkey_export_to_file"
"openssl_pkey_free" "openssl_pkey_get_details" "openssl_pkey_get_private" "openssl_pkey_get_public" "openssl_pkey_new"
"openssl_private_decrypt" "openssl_private_encrypt" "openssl_public_decrypt" "openssl_public_encrypt" "openssl_random_pseudo_bytes"
"openssl_seal" "openssl_sign" "openssl_verify" "openssl_x509_check_private_key" "openssl_x509_checkpurpose"
"openssl_x509_export" "openssl_x509_export_to_file" "openssl_x509_free" "openssl_x509_parse" "openssl_x509_read"
"ord" "output_add_rewrite_var" "output_reset_rewrite_vars" "pack" "parse_ini_file"
"parse_ini_string" "parse_str" "parse_url" "passthru" "password_get_info"
"password_hash" "password_needs_rehash" "password_verify" "pathinfo" "pclose"
"pcntl_alarm" "pcntl_exec" "pcntl_fork" "pcntl_getpriority" "pcntl_setpriority"
"pcntl_signal" "pcntl_signal_dispatch" "pcntl_sigprocmask" "pcntl_wait" "pcntl_waitpid"
"pcntl_wexitstatus" "pcntl_wifexited" "pcntl_wifsignaled" "pcntl_wifstopped" "pcntl_wstopsig"
"pcntl_wtermsig" "pfsockopen" "pg_affected_rows" "pg_cancel_query" "pg_client_encoding"
"pg_close" "pg_connect" "pg_connection_busy" "pg_connection_reset" "pg_connection_status"
"pg_dbname" "pg_escape_bytea" "pg_escape_identifier" "pg_escape_literal" "pg_escape_string"
"pg_execute" "pg_fetch_all" "pg_fetch_all_columns" "pg_fetch_array" "pg_fetch_assoc"
"pg_fetch_object" "pg_fetch_result" "pg_fetch_row" "pg_field_is_null" "pg_field_name"
"pg_field_num" "pg_field_prtlen" "pg_field_size" "pg_field_table" "pg_field_type"
"pg_field_type_oid" "pg_free_result" "pg_get_pid" "pg_get_result" "pg_host"
"pg_last_error" "pg_last_notice" "pg_last_oid" "pg_num_fields" "pg_num_rows"
"pg_options" "pg_parameter_status" "pg_pconnect" "pg_ping" "pg_port"
"pg_prepare" "pg_query" "pg_query_params" "pg_result_error" "pg_result_error_field"
"pg_result_seek" "pg_result_status" "pg_send_execute" "pg_send_prepare" "pg_send_query"
"pg_send_query_params" "pg_set_client_encoding" "pg_set_error_verbosity" "pg_transaction_status" "pg_unescape_bytea"
"pg_version" "php_ini_loaded_file" "php_ini_scanned_files" "php_sapi_name" "php_uname"
"phpinfo" "phpversion" "pi" "png2wbmp" "popen"
"pos" "posix_access" "posix_ctermid" "posix_errno" "posix_get_last_error"
"posix_getcwd" "posix_getegid" "posix_geteuid" "posix_getgid" "posix_getgrgid"
"posix_getgrnam" "posix_getgroups" "posix_getlogin" "posix_getpgid" "posix_getpgrp"
"posix_getpid" "posix_getppid" "posix_getpwnam" "posix_getpwuid" "posix_getrlimit"
"posix_getsid" "posix_getuid" "posix_initgroups" "posix_isatty" "posix_kill"
"posix_mkfifo" "posix_mknod" "posix_setegid" "posix_seteuid" "posix_setgid"
"posix_setpgid" "posix_setsid" "posix_setuid" "posix_strerror" "posix_times"
"posix_ttyname" "posix_uname" "pow" "preg_filter" "preg_grep"
"preg_last_error" "preg_match" "preg_match_all" "preg_quote" "preg_replace"
"preg_replace_callback" "preg_replace_callback_array" "preg_split" "prev" "print_r"
"printf" "proc_close" "proc_get_status" "proc_nice" "proc_open"