emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phps-mode 80791e2: Refactored lexer from lexer-analyzer


From: Christian Johansson
Subject: [elpa] externals/phps-mode 80791e2: Refactored lexer from lexer-analyzer
Date: Sat, 15 Feb 2020 05:02:45 -0500 (EST)

branch: externals/phps-mode
commit 80791e206b5a4a9a17936e3c57a3f5f5490fc0b1
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Refactored lexer from lexer-analyzer
---
 Makefile                                           |   13 +-
 phps-mode-analyzer.el => phps-mode-lex-analyzer.el | 2340 ++++----------------
 phps-mode-lexer.el                                 | 1395 ++++++++++++
 phps-mode-serial.el                                |  221 ++
 phps-mode-test.el                                  |   29 +-
 phps-mode-wy-macros.el                             |    8 +-
 phps-mode.el                                       |   64 +-
 test/phps-mode-test-integration.el                 |  128 +-
 ...functions.el => phps-mode-test-lex-analyzer.el} |  802 +++----
 test/phps-mode-test-lexer.el                       |  299 +--
 test/phps-mode-test-syntax-table.el                |   16 +-
 11 files changed, 2698 insertions(+), 2617 deletions(-)

diff --git a/Makefile b/Makefile
index 9ddbb6f..87b19f8 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ ifdef emacs
 endif
 EMACS_CMD := $(EMACS) -Q -batch -L .
 
-EL  := admin/phps-mode-automation.el phps-mode-analyzer.el 
phps-mode-flymake.el phps-mode-macros.el phps-mode-semantic.el 
phps-mode-syntax-table.el phps-mode-tags.el phps-mode-test.el 
phps-mode-wy-macros.el phps-mode.el test/phps-mode-test-functions.el 
test/phps-mode-test-integration.el test/phps-mode-test-lexer.el 
test/phps-mode-test-parser.el test/phps-mode-test-syntax-table.el
+EL  := admin/phps-mode-automation.el phps-mode-flymake.el 
phps-mode-lex-analyzer.el phps-mode-lexer.el phps-mode-macros.el 
phps-mode-syntax-table.el  phps-mode-test.el phps-mode-wy-macros.el 
phps-mode.el test/phps-mode-test-lex-analyzer.el 
test/phps-mode-test-integration.el test/phps-mode-test-lexer.el 
test/phps-mode-test-parser.el test/phps-mode-test-syntax-table.el
 ELC := $(EL:.el=.elc)
 
 .PHONY: clean
@@ -16,16 +16,17 @@ compile:
        $(EMACS_CMD) -f batch-byte-compile $(EL)
 
 .PHONY: tests
-tests: test-functions test-integration test-lexer test-parser test-syntax-table
-
-.PHONY: test-functions
-test-functions:
-       $(EMACS_CMD) -l test/phps-mode-test-functions.el
+tests: test-integration test-lexer test-lex-analyzer test-parser 
test-syntax-table
 
 .PHONY: test-integration
 test-integration:
        $(EMACS_CMD) -l test/phps-mode-test-integration.el
 
+.PHONY: test-lex-analyzer
+test-functions:
+       $(EMACS_CMD) -l test/phps-mode-test-lex-analyzer.el
+
+
 .PHONY: test-lexer
 test-lexer:
        $(EMACS_CMD) -l test/phps-mode-test-lexer.el -f "phps-mode-test-lexer"
diff --git a/phps-mode-analyzer.el b/phps-mode-lex-analyzer.el
similarity index 52%
rename from phps-mode-analyzer.el
rename to phps-mode-lex-analyzer.el
index 39af742..2f57e83 100644
--- a/phps-mode-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -1,6 +1,6 @@
-;;; phps-mode-analyzer.el -- Lexer and helper functions for PHPs -*- 
lexical-binding: t -*-
+;;; phps-mode-lex-analyzer.el -- Lex analyzer for PHPs -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2018-2019  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2020  Free Software Foundation, Inc.
 
 ;; This file is not part of GNU Emacs.
 
@@ -20,21 +20,21 @@
 
 ;;; Commentary:
 
-;; *Define the lexer for this grammar
-;; based on the Zend PHP Lexer at
-;; `https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l'
-;; which is using re2c.
+;; This file contains all meta-lexer logic. That is things like:
 ;;
+;; * Executing different kinds of lexers based on conditions
 ;; * Also supply logic for indentation and imenu-handling
-;; Change detection and incremental lexer
-;;
+;; * Indentation based on lexer tokens
+;; * Imenu based on lexer tokens
 ;; * Syntax coloring based on lexer tokens
 
+
 ;;; Code:
 
 
+(require 'phps-mode-lexer)
 (require 'phps-mode-macros)
-(require 'phps-mode-wy-macros)
+(require 'phps-mode-serial)
 
 (require 'semantic)
 (require 'semantic/lex)
@@ -42,315 +42,73 @@
 
 (require 'subr-x)
 
-(autoload 'async-start "async")
-
-(defvar phps-mode-inline-mmm-submode nil
-  "Symbol declaring what mmm-mode to use as submode in inline areas.")
-
-(defvar phps-mode-analyzer-change-min nil
-  "The minium point of change.");
-
-(defvar phps-mode-idle-interval 1
-  "Idle seconds before running the incremental lexer.")
-
-(defvar phps-mode-async-process nil
-  "Whether or not to use asynchronous process.")
-
-(defvar phps-mode-async-process-using-async-el nil
-  "Use async.el for asynchronous processing.")
 
-(defvar phps-mode-async-processes (make-hash-table :test 'equal)
-  "Table of active asynchronous processes.")
+;; FLAGS
 
-(defvar phps-mode-async-threads (make-hash-table :test 'equal)
-  "Table of active asynchronous threads.")
 
-(defvar phps-mode-functions-allow-after-change t
+(defvar-local phps-mode-lex-analyzer--allow-after-change-p t
   "Flag to tell us whether after change detection is enabled or not.")
 
-(defvar phps-mode-functions-idle-timer nil
-  "Timer object of idle timer.")
-
-(defvar phps-mode-functions-imenu nil
-  "The Imenu alist for current buffer, nil if none.")
-
-(defvar phps-mode-functions-lines-indent nil
-  "The indentation of each line in buffer, nil if none.")
+(defvar-local phps-mode-lex-analyzer--change-min nil
+  "The minium point of change.");
 
-(defvar phps-mode-functions-processed-buffer nil
+(defvar-local phps-mode-lex-analyzer--processed-buffer-p nil
   "Flag whether current buffer is processed or not.")
 
-(defvar phps-mode-analyzer-process-on-indent-and-imenu nil
+(defvar-local phps-mode-lex-analyzer--process-on-indent-and-imenu-p nil
   "Whether to automatically process buffer when using indent or imenu.")
 
-(defvar phps-mode-lexer-tokens nil
-  "Last lexer tokens.")
-
-(defvar phps-mode-lexer-states nil
-  "A list of lists containing start, state and state stack.")
-
-
-;; SETTINGS
-
-
-;; @see https://secure.php.net/manual/en/language.types.integer.php
-(defvar phps-mode-lexer-long-limit 2147483648
-  "Limit for 32-bit integer.")
 
+;; VARIABLES
 
-(phps-mode-wy-macros-CG 'PARSER_MODE t)
-(phps-mode-wy-macros-CG 'SHORT_TAGS t)
 
+(defvar-local phps-mode-lex-analyzer--idle-timer nil
+  "Timer object of idle timer.")
 
-;; FLAGS/SIGNALS
-
-
-(defvar phps-mode-lexer-declaring_namespace nil
-  "Flag whether we are declaring namespace.")
-
-(defvar phps-mode-lexer-prepend_trailing_brace nil
-  "Flag whether we should prepend trailing brace.")
-
-(defvar phps-mode-lexer-STATE nil
-  "Current state.")
-
-(defvar phps-mode-lexer-state_stack nil
-  "Stack of states.")
-
-(defvar phps-mode-lexer-EXPECTED nil
-  "Flag whether something is expected or not.")
-
-(defvar phps-mode-lexer-heredoc_label_stack (list)
-  "The current heredoc_label.")
-
-
-;; REGULAR EXPRESSIONS
-
-
-(defvar phps-mode-lexer-BNUM "0b[01]+"
-  "Boolean number.")
-
-(defvar phps-mode-lexer-HNUM "0x[0-9a-fA-F]+"
-  "Hexadecimal number.")
-
-(defvar phps-mode-lexer-LNUM "[0-9]+"
-  "Long number.")
-
-(defvar phps-mode-lexer-DNUM "\\([0-9]*\\.[0-9]+\\)\\|\\([0-9]+\\.[0-9]*\\)"
-  "Double number.")
-
-(defvar phps-mode-lexer-EXPONENT_DNUM
-  (format "\\(\\(%s\\|%s\\)[eE][\\+-]?%s\\)"
-          phps-mode-lexer-LNUM
-          phps-mode-lexer-DNUM
-          phps-mode-lexer-LNUM)
-  "Exponent double number.")
-
-(defvar phps-mode-lexer-LABEL
-  "[A-Za-z_[:nonascii:]][0-9A-Za-z_[:nonascii:]]*"
-  "Labels are used for names.")
-;; NOTE original is [a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*
-;; NOTE Rebuilt for comparability with emacs-lisp
+(defvar-local phps-mode-lex-analyzer--imenu nil
+  "The Imenu alist for current buffer, nil if none.")
 
-(defvar phps-mode-lexer-WHITESPACE "[ \n\r\t]+"
-  "White-space.")
+(defvar-local phps-mode-lex-analyzer--lines-indent nil
+  "The indentation of each line in buffer, nil if none.")
 
-(defvar phps-mode-lexer-TABS_AND_SPACES "[ \t]*"
-  "Tabs and white-spaces.")
+(defvar-local phps-mode-lex-analyzer--tokens nil
+  "Latest tokens.")
 
-(defvar phps-mode-lexer-TOKENS "[][;:,.()|^&+/*=%!~$<>?@-]"
-  "Tokens.")
-;; NOTE Original is [;:,.\[\]()|^&+-/*=%!~$<>?@]
-;; NOTE The hyphen moved last since it has special meaning and to avoid it 
being interpreted as a range.
+(defvar-local phps-mode-lex-analyzer--state nil
+  "Latest state.")
 
-(defvar phps-mode-lexer-ANY_CHAR "[^z-a]"
-  "Any character.  The Zend equivalent is [^] but is not possible in Emacs 
Lisp.")
+(defvar-local phps-mode-lex-analyzer--states nil
+  "History of state and stack-stack.")
 
-(defvar phps-mode-lexer-NEWLINE "[\n\r]"
-  "Newline characters.  The Zend equivalent is (\"\r\"|\"\n\"|\"\r\n\").")
+(defvar-local phps-mode-lex-analyzer--state-stack nil
+  "Latest state-stack.")
 
 
 ;; FUNCTIONS
 
-(defun phps-mode-serial-commands (key start end &optional callback)
-  "Run command with KEY, first START and then END, optionally call CALLBACK at 
the end."
-  (let ((start-time (current-time)))
-    (if phps-mode-async-process
-        (if phps-mode-async-process-using-async-el
-            (progn
-              (require 'async)
-
-              (phps-mode-debug-message
-               (message "Running serial command asynchronously using async.el 
at: %s" start-time))
-
-              ;; Kill async process if process with associated key already 
exists
-              (when (and
-                     (gethash key phps-mode-async-processes)
-                     (process-live-p (gethash key phps-mode-async-processes)))
-                (let ((process-buffer (process-buffer (gethash key 
phps-mode-async-processes))))
-                  (delete-process (gethash key phps-mode-async-processes))
-                  (kill-buffer process-buffer)
-                  (phps-mode-debug-message
-                   (message "Killed existing buffer and process"))))
-
-              ;; Run command(s) asynchronously
-              (let ((script-filename (file-name-directory (symbol-file 
'phps-mode-serial-commands))))
-                (puthash
-                 key
-                 (async-start
-                  (lambda()
-                    (add-to-list 'load-path script-filename)
-                    (require 'phps-mode)
-                    (setq debug-on-signal t)
-                    (condition-case conditions
-                        (progn
-                          (let ((start-return (funcall start)))
-                            (list 'success start-return start-time)))
-                      (error (list 'error conditions start-time))))
-                  (lambda (start-return)
-                    (phps-mode-debug-message
-                     (message "Async.el return: %s" start-return))
-                    (let ((status (car start-return))
-                          (value (car (cdr start-return)))
-                          (start-time (car (cdr (cdr start-return))))
-                          (return nil))
-                      ;; (message "Running end code with status %s start-time: 
%s" status start-time)
-                      (when (string= status "success")
-                        ;; (message "Running end code %s with argument: %s" 
end value)
-                        (condition-case conditions
-                            (progn
-                              (let ((end-return (funcall end value)))
-                                (setq return (list 'success end-return))))
-                          (error (setq return (list 'error conditions)))))
-
-                      (phps-mode-debug-message
-                       (let* ((end-time (current-time))
-                              (end-time-float (+ (car end-time) (car (cdr 
end-time)) (* (car (cdr (cdr end-time))) 0.000001)))
-                              (start-time-float (+ (car start-time) (car (cdr 
start-time)) (* (car (cdr (cdr start-time))) 0.000001)))
-                              (elapsed (- end-time-float start-time-float)))
-                         (message "Asynchronous serial command using async.el 
finished, elapsed: %fs" elapsed)))
-
-                      (when (string= status "error")
-                        (display-warning 'phps-mode (format "Async error %s" 
(cdr start-return)) :debug))
-
-                      (when (and (boundp 'callback)
-                                 callback)
-                        (funcall callback return)))))
-                 phps-mode-async-processes))
-
-              ;; (message "Done running serial command asynchronously using 
async.el")
-              (phps-mode-debug-message
-               (message "Done starting asynchronous command using async.el: 
%s" key)))
-
-          (phps-mode-debug-message
-           (message "Running serial command asynchronously using threads at: 
%s" (car start-time)))
-
-          ;; Kill thread if thread with associated key already exists
-          (when (and
-                 (gethash key phps-mode-async-threads)
-                 (thread-live-p (gethash key phps-mode-async-threads)))
-            (thread-signal (gethash key phps-mode-async-threads) 'quit nil))
-
-          ;; Run command(s) asynchronously
-          (puthash
-           key
-           (make-thread
-            (lambda()
-              (let ((return nil))
-                (condition-case conditions
-                    (progn
-                      (let ((start-return (funcall start)))
-                        (let ((end-return (funcall end start-return)))
-                          (setq return (list 'success end-return)))))
-                  (error (setq return (list 'error "Serial command received 
error" conditions))))
-
-                (phps-mode-debug-message
-                 (let* ((end-time (current-time))
-                        (end-time-float (+ (car end-time) (car (cdr end-time)) 
(* (car (cdr (cdr end-time))) 0.000001)))
-                        (start-time-float (+ (car start-time) (car (cdr 
start-time)) (* (car (cdr (cdr start-time))) 0.000001)))
-                        (elapsed (- end-time-float start-time-float)))
-                   (message "Asynchronous serial command using thread 
finished, elapsed: %fs" elapsed)))
-
-                (when (and (boundp 'callback)
-                           callback)
-                  (funcall callback return))))
-            key)
-           phps-mode-async-threads)
 
-          (phps-mode-debug-message
-           (message "Done starting asynchronous serial command using threads: 
%s" key)))
-
-      (let ((return nil))
-        (phps-mode-debug-message
-         (message "Running serial command synchronously at: %s" (car 
start-time)))
-
-        (condition-case conditions
-            (progn
-              (let ((start-return (funcall start)))
-                (let ((end-return (funcall end start-return)))
-                  (setq return (list 'success end-return)))))
-          (error (setq return (list 'error "Serial command received error" 
conditions))))
-
-        (phps-mode-debug-message
-         (let* ((end-time (current-time))
-                (end-time-float (+ (car end-time) (car (cdr end-time)) (* (car 
(cdr (cdr end-time))) 0.000001)))
-                (start-time-float (+ (car start-time) (car (cdr start-time)) 
(* (car (cdr (cdr start-time))) 0.000001)))
-                (elapsed (- end-time-float start-time-float)))
-           (message "Synchronous serial command finished, elapsed: %fs" 
elapsed)))
-
-        (when (and (boundp 'callback)
-                   callback)
-          (funcall callback return))))))
-
-(defun phps-mode-lexer-BEGIN (state)
-  "Begin STATE."
-  ;; (message "Begun state %s" state)
-  (setq-local phps-mode-lexer-STATE state))
-
-;; _yy_push_state
-(defun phps-mode-lexer-yy_push_state (new-state)
-  "Add NEW-STATE to stack and then begin state."
-  (push phps-mode-lexer-STATE phps-mode-lexer-state_stack)
-  ;; (message "Added state %s to stack begun state %s" phps-mode-lexer-STATE 
new-state)
-  (phps-mode-lexer-BEGIN new-state))
-
-(defun phps-mode-lexer-yy_pop_state ()
-  "Pop current state from stack."
-  (let ((old-state (pop phps-mode-lexer-state_stack)))
-    ;; (message "Going back to poppped state %s" old-state)
-    (if old-state
-        (phps-mode-lexer-BEGIN old-state)
-      (signal 'error (list
-                      (format "PHPs Lexer Error - Trying to pop last state at 
%d" (point))
-                      (point))))))
-
-(defun phps-mode-lexer-MOVE_FORWARD (position)
-  "Move forward to POSITION."
-  (when (boundp 'semantic-lex-end-point)
-    (setq semantic-lex-end-point position)))
-
-(defun phps-mode-lexer-yyless (points)
-  "Move lexer back POINTS."
-  (when (boundp 'semantic-lex-end-point)
-    (setq semantic-lex-end-point (- semantic-lex-end-point points))))
-
-(defun phps-mode-lexer-set-region-syntax-color (start end properties)
+(defun phps-mode-lex-analyzer--reset-local-variables ()
+  "Reset local variables."
+  (setq phps-mode-lex-analyzer--allow-after-change-p t)
+  (setq phps-mode-lex-analyzer--change-min nil)
+  (setq phps-mode-lex-analyzer--idle-timer nil)
+  (setq phps-mode-lex-analyzer--lines-indent nil)
+  (setq phps-mode-lex-analyzer--imenu nil)
+  (setq phps-mode-lex-analyzer--processed-buffer-p nil)
+  (setq phps-mode-lex-analyzer--tokens nil)
+  (setq phps-mode-lex-analyzer--state nil)
+  (setq phps-mode-lex-analyzer--states nil)
+  (setq phps-mode-lex-analyzer--state-stack nil))
+
+(defun phps-mode-lex-analyzer--set-region-syntax-color (start end properties)
   "Do syntax coloring for region START to END with PROPERTIES."
   (with-silent-modifications (set-text-properties start end properties)))
 
-(defun phps-mode-lexer-clear-region-syntax-color (start end)
+(defun phps-mode-lex-analyzer--clear-region-syntax-color (start end)
   "Clear region of syntax coloring from START to END."
   (with-silent-modifications (set-text-properties start end nil)))
 
-(defun phps-mode-anaylzer-inline-char-handler ()
-  "Mimic inline_char_handler."
-  (let ((start (match-beginning 0)))
-    (let ((string-start (search-forward "<?" nil t)))
-      (if string-start
-          (phps-mode-lexer-RETURN_TOKEN 'T_INLINE_HTML start (- string-start 
2))
-        (phps-mode-lexer-RETURN_TOKEN 'T_INLINE_HTML start (point-max))))))
-
-(defun phps-mode-lexer-get-token-syntax-color (token)
+(defun phps-mode-lex-analyzer--get-token-syntax-color (token)
   "Return syntax color for TOKEN."
   ;; Syntax coloring
   ;; see 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html#Faces-for-Font-Lock
@@ -514,103 +272,48 @@
      )
     (list 'font-lock-face 'font-lock-constant-face))
 
-   (t (list 'font-lock-face 'font-lock-constant-face))))
+   ((string= token 'T_ERROR)
+    ;; NOTE This token is artificial and not PHP native
+    (list 'font-lock-face 'font-lock-warning-face))
 
-(defun phps-mode-lexer-RETURN_OR_SKIP_TOKEN (token start end)
-  "Return TOKEN with START and END but only in parse-mode."
-  (when (phps-mode-wy-macros-CG 'PARSER_MODE)
-    (phps-mode-analyzer-emit-token token start end)))
-
-(defun phps-mode-lexer-RETURN_TOKEN (token start end)
-  "Push TOKEN to list with START and END."
-  (phps-mode-analyzer-emit-token token start end))
-
-(defun phps-mode-analyzer-emit-token (token start end)
-  "Emit TOKEN with START and END."
-
-  ;; (when (and
-  ;;        (equal token 'T_INLINE_HTML)
-  ;;        phps-mode-inline-mmm-submode
-  ;;        (fboundp 'mmm-make-region))
-  ;;   (mmm-make-region phps-mode-inline-mmm-submode start end))
-
-  ;; Push token start, end, lexer state and state stack to variable
-  (push
-   (list start end phps-mode-lexer-STATE phps-mode-lexer-state_stack) 
phps-mode-lexer-states)
-
-  (semantic-lex-push-token (semantic-lex-token token start end)))
-
-;; TODO Figure out what this does
-(defun phps-mode-lexer-SKIP_TOKEN (_token _start _end)
-  "Skip TOKEN to list with START and END.")
-
-(defvar phps-mode-lexer-re2c-matching-body nil
-  "Lambda-expression for longest matching condition.")
-
-(defvar phps-mode-lexer-re2c-matching-length nil
-  "Length of longest matching condition.")
-
-(defvar phps-mode-lexer-re2c-matching-data nil
-  "Match data for longest matching condition.")
-
-(defun phps-mode-lexer-re2c-rule (condition body)
-  "Process rule with CONDITION and BODY."
-  (when condition
-    (let ((match-end (match-end 0))
-          (match-beginning (match-beginning 0)))
-      (let ((matching-length (- match-end match-beginning)))
-        (when (> matching-length 0)
-          (when (or (not phps-mode-lexer-re2c-matching-length)
-                    (> matching-length phps-mode-lexer-re2c-matching-length))
-            (setq phps-mode-lexer-re2c-matching-length matching-length)
-            (setq phps-mode-lexer-re2c-matching-data (match-data))
-            (setq phps-mode-lexer-re2c-matching-body body)))))))
-
-(defun phps-mode-lexer-re2c-execute ()
-  "Execute matching body (if any)."
-  (if phps-mode-lexer-re2c-matching-body
-      (progn
-        
-        ;; (message "Executing body: %s" phps-mode-lexer-re2c-matching-body)
-        ;; (message "Found match %s" phps-mode-lexer-re2c-matching-data)
-        (set-match-data phps-mode-lexer-re2c-matching-data)
-        (funcall phps-mode-lexer-re2c-matching-body))
-    (signal 'error (list "Found no matching lexer rule to execute at %d" 
(point)))))
+   (t (list 'font-lock-face 'font-lock-constant-face))))
 
 
 ;; LEXERS
 
-(define-lex-analyzer phps-mode-analyzer-lexer
-  "Elisp port of original Zend re2c lexer."
+
+(define-lex-analyzer phps-mode-lex-analyzer--cached-lex-analyzer
+  "Return latest processed tokens or else just return one giant error token."
   t
 
   (let ((old-start (point)))
-    (if phps-mode-lexer-tokens
+    (if phps-mode-lex-analyzer--tokens
         (progn
           ;; Add all updated tokens to semantic
           (phps-mode-debug-message
            (message
             "Updating semantic lexer tokens from point %s, tokens: %s, 
point-max: %s"
             old-start
-            phps-mode-lexer-tokens
+            phps-mode-lex-analyzer--tokens
             (point-max)))
-          (dolist (token phps-mode-lexer-tokens)
+          (dolist (token phps-mode-lex-analyzer--tokens)
             (let ((start (car (cdr token)))
                   (end (cdr (cdr token)))
                   (token-name (car token)))
 
               ;; Apply syntax color on token
-              (let ((token-syntax-color 
(phps-mode-lexer-get-token-syntax-color token-name)))
+              (let ((token-syntax-color
+                     (phps-mode-lex-analyzer--get-token-syntax-color 
token-name)))
                 (if token-syntax-color
-                    (phps-mode-lexer-set-region-syntax-color start end 
token-syntax-color)
-                  (phps-mode-lexer-clear-region-syntax-color start end)))
+                    (phps-mode-lex-analyzer--set-region-syntax-color start end 
token-syntax-color)
+                  (phps-mode-lex-analyzer--clear-region-syntax-color start 
end)))
 
               (semantic-lex-push-token
                (semantic-lex-token token-name start end))))
 
-          (phps-mode-lexer-MOVE_FORWARD (point-max)))
+          (setq semantic-lex-end-point (point-max)))
 
-      (phps-mode-lexer-set-region-syntax-color
+      (phps-mode-lex-analyzer--set-region-syntax-color
        (point-min)
        (point-max)
        (list 'font-lock-face 'font-lock-warning-face))
@@ -618,1419 +321,162 @@
       (semantic-lex-push-token
        (semantic-lex-token 'T_ERROR (point-min) (point-max))))))
 
-;; If multiple rules match, re2c prefers the longest match. If rules match the 
same string, the earlier rule has priority.
+;; If multiple rules match, re2c prefers the longest match.
+;; If rules match the same string, the earlier rule has priority.
 ;; @see http://re2c.org/manual/syntax/syntax.html
-(define-lex-analyzer phps-mode-analyzer-re2c-lexer
+(define-lex-analyzer phps-mode-lex-analyzer--re2c-lex-analyzer
   "Elisp port of original Zend re2c lexer."
   t
+  (phps-mode-lexer--re2c))
 
-  (let ((old-start (point)))
-
-    (phps-mode-debug-message (message "Running lexer from %s" old-start))
-    
-    (let ((heredoc_label (car phps-mode-lexer-heredoc_label_stack))
-          (SHEBANG (equal phps-mode-lexer-STATE 'SHEBANG))
-          (ST_IN_SCRIPTING (equal phps-mode-lexer-STATE 'ST_IN_SCRIPTING))
-          (ST_INITIAL (equal phps-mode-lexer-STATE 'ST_INITIAL))
-          (ST_LOOKING_FOR_PROPERTY (equal phps-mode-lexer-STATE 
'ST_LOOKING_FOR_PROPERTY))
-          (ST_DOUBLE_QUOTES (equal phps-mode-lexer-STATE 'ST_DOUBLE_QUOTES))
-          (ST_BACKQUOTE (equal phps-mode-lexer-STATE 'ST_BACKQUOTE))
-          (ST_HEREDOC (equal phps-mode-lexer-STATE 'ST_HEREDOC))
-          (ST_NOWDOC (equal phps-mode-lexer-STATE 'ST_NOWDOC))
-          (ST_LOOKING_FOR_VARNAME (equal phps-mode-lexer-STATE 
'ST_LOOKING_FOR_VARNAME))
-          (ST_END_HEREDOC (equal phps-mode-lexer-STATE 'ST_END_HEREDOC))
-          (ST_VAR_OFFSET (equal phps-mode-lexer-STATE 'ST_VAR_OFFSET)))
-
-      ;; Reset re2c flags
-      (setq phps-mode-lexer-re2c-matching-body nil)
-      (setq phps-mode-lexer-re2c-matching-length nil)
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "exit"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_EXIT (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "die"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DIE (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "fn"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_FN (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "function"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_FUNCTION (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "const"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CONST (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "return"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_RETURN (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat "yield" phps-mode-lexer-WHITESPACE "from" 
"[^a-zA-Z0-9_\x80-\xff]")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_YIELD_FROM (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "yield"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_YIELD (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "try"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_TRY (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "catch"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CATCH (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "finally"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_FINALLY (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "throw"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_THROW (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "if"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_IF (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "elseif"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ELSEIF (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "endif"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ENDIF (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "else"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ELSE (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "while"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_WHILE (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "endwhile"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ENDWHILE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "do"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DO (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "for"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_FOR (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "endfor"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ENDFOR (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "foreach"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_FOREACH (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "endforeach"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ENDFOREACH (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "declare"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DECLARE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "enddeclare"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ENDDECLARE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "instanceof"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_INSTANCEOF (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "as"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_AS (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "switch"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_SWITCH (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "endswitch"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ENDSWITCH (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "case"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CASE (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "default"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DEFAULT (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "break"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_BREAK (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "continue"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CONTINUE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "goto"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_GOTO (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "echo"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ECHO (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "print"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_PRINT (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "class"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CLASS (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "interface"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_INTERFACE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "trait"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_TRAIT (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "extends"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_EXTENDS (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "implements"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_IMPLEMENTS (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "->"))
-       (lambda()
-         (phps-mode-lexer-yy_push_state 'ST_LOOKING_FOR_PROPERTY)
-         (phps-mode-lexer-RETURN_TOKEN 'T_OBJECT_OPERATOR (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and (or ST_IN_SCRIPTING ST_LOOKING_FOR_PROPERTY)
-            (looking-at phps-mode-lexer-WHITESPACE))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (data (buffer-substring-no-properties start end)))
-           (if (phps-mode-wy-macros-CG 'PARSER_MODE)
-               (phps-mode-lexer-MOVE_FORWARD end)
-             (phps-mode-lexer-RETURN_TOKEN data start end)))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_LOOKING_FOR_PROPERTY (looking-at "->"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_OBJECT_OPERATOR (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_LOOKING_FOR_PROPERTY (looking-at phps-mode-lexer-LABEL))
-       (lambda()
-         (let ((start (match-beginning 0))
-               (end (match-end 0)))
-           (phps-mode-lexer-yy_pop_state)
-           (phps-mode-lexer-RETURN_TOKEN 'T_STRING start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_LOOKING_FOR_PROPERTY (looking-at phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         (let ((end (match-end 0)))
-           (phps-mode-lexer-yy_pop_state)
-           ;; TODO goto restart here?
-           ;; (message "Restart here")
-           (phps-mode-lexer-MOVE_FORWARD end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "::"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_PAAMAYIM_NEKUDOTAYIM 
(match-beginning 0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\\\"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_NS_SEPARATOR (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\.\\.\\."))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ELLIPSIS (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\?\\?"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_COALESCE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "new"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_NEW (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "clone"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CLONE (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "var"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_VAR (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "("
-              phps-mode-lexer-TABS_AND_SPACES
-              "\\(int\\|integer\\)"
-              phps-mode-lexer-TABS_AND_SPACES
-              ")")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_INT_CAST (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "("
-              phps-mode-lexer-TABS_AND_SPACES
-              "\\(double\\|float\\)"
-              phps-mode-lexer-TABS_AND_SPACES
-              ")")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DOUBLE_CAST (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "("
-              phps-mode-lexer-TABS_AND_SPACES
-              "\\(real\\)"
-              phps-mode-lexer-TABS_AND_SPACES
-              ")")))
-       (lambda()
-         (when (phps-mode-wy-macros-CG 'PARSER_MODE)
-           (signal 'phps-mode (list
-                               (format
-                                "PHPs Lexer Error - The (real) cast is 
deprecated, use (float) instead at %d"
-                                (match-beginning 0)
-                                )
-                               (match-beginning 0)
-                               (match-end 0))))
-         (phps-mode-lexer-RETURN_TOKEN 'T_DOUBLE_CAST (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "("
-              phps-mode-lexer-TABS_AND_SPACES
-              "\\(string\\|binary\\)"
-              phps-mode-lexer-TABS_AND_SPACES
-              ")")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_STRING_CAST (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "("
-              phps-mode-lexer-TABS_AND_SPACES
-              "array"
-              phps-mode-lexer-TABS_AND_SPACES
-              ")")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ARRAY_CAST (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "("
-              phps-mode-lexer-TABS_AND_SPACES
-              "object"
-              phps-mode-lexer-TABS_AND_SPACES
-              ")")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_OBJECT_CAST (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at (concat "(" 
phps-mode-lexer-TABS_AND_SPACES "\\(bool\\|boolean\\)" 
phps-mode-lexer-TABS_AND_SPACES ")")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_BOOL_CAST (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "("
-              phps-mode-lexer-TABS_AND_SPACES
-              "unset"
-              phps-mode-lexer-TABS_AND_SPACES ")")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_UNSET_CAST (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "eval"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_EVAL (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "include"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_INCLUDE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "include_once"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_INCLUDE_ONCE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "require"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_REQUIRE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "require_once"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_REQUIRE_ONCE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "namespace"))
-       (lambda()
-         (setq phps-mode-lexer-declaring_namespace t)
-         (phps-mode-lexer-RETURN_TOKEN 'T_NAMESPACE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "use"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_USE (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "insteadof"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_INSTEADOF (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "global"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_GLOBAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "isset"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ISSET (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "empty"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_EMPTY (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__halt_compiler"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_HALT_COMPILER (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "static"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_STATIC (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "abstract"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ABSTRACT (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "final"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_FINAL (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "private"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_PRIVATE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "protected"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_PROTECTED (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "public"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_PUBLIC (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "unset"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_UNSET (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "=>"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DOUBLE_ARROW (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "list"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_LIST (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "array"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_ARRAY (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "callable"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CALLABLE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\+\\+"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_INC (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "--"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DEC (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "==="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_IS_IDENTICAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "!=="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_IS_NOT_IDENTICAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "=="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_IS_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\(!=\\|<>\\)"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_IS_NOT_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "<=>"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_SPACESHIP (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "<="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_IS_SMALLER_OR_EQUAL (match-beginning 
0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at ">="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_IS_GREATER_OR_EQUAL (match-beginning 
0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\+="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_PLUS_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "-="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_MINUS_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\*="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_MUL_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\*\\\\\\*="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_POW_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\*\\\\\\*"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_POW (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "/="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DIV_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\.="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CONCAT_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "%="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_MOD_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "<<="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_SL_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at ">>="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_SR_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "&="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_AND_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "|="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_OR_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\^="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_XOR_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\?\\?="))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_COALESCE_EQUAL (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "||"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_BOOLEAN_OR (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "&&"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_BOOLEAN_AND (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "OR"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_LOGICAL_OR (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "AND"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_LOGICAL_AND (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "XOR"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_LOGICAL_XOR (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "<<"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_SL (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at ">>"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_SR (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at phps-mode-lexer-TOKENS))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (data (buffer-substring-no-properties start end))
-                (use-brace nil))
-           ;; (message "Found token '%s'" data)
-           (when phps-mode-lexer-declaring_namespace
-             (when (string= data ";")
-               (setq phps-mode-lexer-prepend_trailing_brace t)
-               ;; (message "Set flag prepend trailing brace")
-               ;; (setq use-brace t)
-               )
-             (setq phps-mode-lexer-declaring_namespace nil))
-           (if use-brace
-               (phps-mode-lexer-RETURN_TOKEN "{" start end)
-             (phps-mode-lexer-RETURN_TOKEN data start end)))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "{"))
-       (lambda()
-         (phps-mode-lexer-yy_push_state 'ST_IN_SCRIPTING)
-         (when phps-mode-lexer-declaring_namespace
-           (setq phps-mode-lexer-declaring_namespace nil))
-         (phps-mode-lexer-RETURN_TOKEN "{" (match-beginning 0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and (or ST_DOUBLE_QUOTES ST_BACKQUOTE ST_HEREDOC) (looking-at "\\${"))
-       (lambda()
-         (phps-mode-lexer-yy_push_state 'ST_LOOKING_FOR_VARNAME)
-         (phps-mode-lexer-RETURN_TOKEN 'T_DOLLAR_OPEN_CURLY_BRACES 
(match-beginning 0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "}"))
-       (lambda()
-         (when phps-mode-lexer-state_stack
-           (phps-mode-lexer-yy_pop_state))
-         (phps-mode-lexer-RETURN_TOKEN "}" (match-beginning 0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_LOOKING_FOR_VARNAME (looking-at (concat phps-mode-lexer-LABEL 
"[\\[}]")))
-       (lambda()
-         (let ((start (match-beginning 0))
-               (end (- (match-end 0) 1)))
-           ;; (message "Stopped here")
-           (phps-mode-lexer-yy_pop_state)
-           (phps-mode-lexer-yy_push_state 'ST_IN_SCRIPTING)
-           (phps-mode-lexer-RETURN_TOKEN 'T_STRING_VARNAME start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_LOOKING_FOR_VARNAME (looking-at phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         (phps-mode-lexer-yy_pop_state)
-         (phps-mode-lexer-yy_push_state 'ST_IN_SCRIPTING)))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at phps-mode-lexer-BNUM))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (data (buffer-substring-no-properties (+ start 2) end))
-                (long-number (string-to-number data 2)))
-           ;; (message "Binary number %s from %s" long-number data)
-           (if (> long-number phps-mode-lexer-long-limit)
-               (phps-mode-lexer-RETURN_TOKEN 'T_DNUMBER start end)
-             (phps-mode-lexer-RETURN_TOKEN 'T_LNUMBER start end)))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at phps-mode-lexer-LNUM))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (data (string-to-number (buffer-substring-no-properties start 
end))))
-           ;; (message "Long number: %d" data)
-           (if (> data phps-mode-lexer-long-limit)
-               (phps-mode-lexer-RETURN_TOKEN 'T_DNUMBER start end)
-             (phps-mode-lexer-RETURN_TOKEN 'T_LNUMBER start end)))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at phps-mode-lexer-HNUM))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (data (buffer-substring-no-properties (+ start 2) end))
-                (long-number (string-to-number data 16)))
-           ;; (message "Hexadecimal number %s from %s" long-number data)
-           (if (> long-number phps-mode-lexer-long-limit)
-               (phps-mode-lexer-RETURN_TOKEN 'T_DNUMBER start end)
-             (phps-mode-lexer-RETURN_TOKEN 'T_LNUMBER start end)))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_VAR_OFFSET (looking-at "\\([0]\\|[1-9][0-9]*\\)"))
-       (lambda()
-         (let ((start (match-beginning 0))
-               (end (match-end 0)))
-           (phps-mode-lexer-RETURN_TOKEN 'T_NUM_STRING start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_VAR_OFFSET (looking-at (concat "\\("
-                                              phps-mode-lexer-LNUM "\\|"
-                                              phps-mode-lexer-HNUM "\\|"
-                                              phps-mode-lexer-BNUM "\\)")))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_NUM_STRING (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (or (looking-at phps-mode-lexer-EXPONENT_DNUM)
-                                (looking-at phps-mode-lexer-DNUM)))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (_data (buffer-substring-no-properties start end)))
-           ;; (message "Exponent/double at: %s" _data)
-           (phps-mode-lexer-RETURN_TOKEN 'T_DNUMBER start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__CLASS__"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_CLASS_C (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__TRAIT__"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_TRAIT_C (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__FUNCTION__"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_FUNC_C (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__METHOD__"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_METHOD_C (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__LINE__"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_LINE (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__FILE__"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_FILE (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__DIR__"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_DIR (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "__NAMESPACE__"))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_NS_C (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and SHEBANG (looking-at (concat "#!.*" phps-mode-lexer-NEWLINE)))
-       (lambda()
-         (phps-mode-lexer-BEGIN 'ST_INITIAL)))
-
-      (phps-mode-lexer-re2c-rule
-       (and SHEBANG (looking-at phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         (phps-mode-lexer-BEGIN 'ST_INITIAL)))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_INITIAL (looking-at "<\\?="))
-       (lambda()
-         (let ((start (match-beginning 0))
-               (end (match-end 0)))
-           (phps-mode-lexer-BEGIN 'ST_IN_SCRIPTING)
-           (when (phps-mode-wy-macros-CG 'PARSER_MODE)
-             (phps-mode-lexer-RETURN_TOKEN 'T_ECHO start end))
-           (phps-mode-lexer-RETURN_TOKEN 'T_OPEN_TAG_WITH_ECHO start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_INITIAL (looking-at (concat "<\\?php\\([ \t]\\|" 
phps-mode-lexer-NEWLINE "\\)")))
-       (lambda()
-         (let ((start (match-beginning 0))
-               (end (match-end 0)))
-           (phps-mode-lexer-BEGIN 'ST_IN_SCRIPTING)
-           ;; (message "Starting scripting after <?php")
-           (when phps-mode-lexer-EXPECTED
-             (phps-mode-lexer-SKIP_TOKEN 'T_OPEN_TAG start end))
-           (phps-mode-lexer-RETURN_TOKEN 'T_OPEN_TAG start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_INITIAL (looking-at "<\\?php"))
-       (lambda()
-         (let ((start (match-beginning 0))
-               (end (match-end 0)))
-
-           ;; Allow <?php followed by end of file.
-           (cond
-
-            ((equal end (point-max))
-             (phps-mode-lexer-BEGIN 'ST_IN_SCRIPTING)
-             (phps-mode-lexer-RETURN_OR_SKIP_TOKEN
-              'T_OPEN_TAG
-              start
-              end))
-
-            ((phps-mode-wy-macros-CG 'SHORT_TAGS)
-             (phps-mode-lexer-yyless 3)
-             (setq end (- end 3))
-             (phps-mode-lexer-BEGIN 'ST_IN_SCRIPTING)
-             (phps-mode-lexer-RETURN_OR_SKIP_TOKEN
-              'T_OPEN_TAG
-              start
-              end))
-
-            (t
-             (phps-mode-anaylzer-inline-char-handler))))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_INITIAL (looking-at "<\\?"))
-       (lambda()
-         (when (phps-mode-wy-macros-CG 'SHORT_TAGS)
-           (let ((start (match-beginning 0))
-                 (end (match-end 0)))
-             (phps-mode-lexer-BEGIN 'ST_IN_SCRIPTING)
-             (when phps-mode-lexer-EXPECTED
-               (phps-mode-lexer-SKIP_TOKEN 'T_OPEN_TAG start end))
-             ;; (message "Starting scripting after <?")
-             (phps-mode-lexer-RETURN_TOKEN 'T_OPEN_TAG start end)))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_INITIAL (looking-at phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         (phps-mode-anaylzer-inline-char-handler)))
-
-      (phps-mode-lexer-re2c-rule
-       (and (or ST_DOUBLE_QUOTES ST_HEREDOC ST_BACKQUOTE)
-            (looking-at
-             (concat
-              "\\$"
-              phps-mode-lexer-LABEL
-              "->"
-              "[a-zA-Z_\x80-\xff]")))
-       (lambda()
-         (phps-mode-lexer-yy_push_state 'ST_LOOKING_FOR_PROPERTY)
-         (forward-char -3)
-         (phps-mode-lexer-RETURN_TOKEN 'T_VARIABLE (match-beginning 0) (- 
(match-end 0) 3))))
-
-      (phps-mode-lexer-re2c-rule
-       (and (or ST_DOUBLE_QUOTES ST_HEREDOC ST_BACKQUOTE)
-            (looking-at
-             (concat
-              "\\$"
-              phps-mode-lexer-LABEL
-              "\\[")))
-       (lambda()
-         (phps-mode-lexer-yy_push_state 'ST_VAR_OFFSET)
-         (phps-mode-lexer-RETURN_TOKEN 'T_VARIABLE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and (or ST_IN_SCRIPTING ST_DOUBLE_QUOTES ST_HEREDOC ST_BACKQUOTE 
ST_VAR_OFFSET)
-            (looking-at
-             (concat
-              "\\$"
-              phps-mode-lexer-LABEL)))
-       (lambda()
-         (phps-mode-lexer-RETURN_TOKEN 'T_VARIABLE (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_VAR_OFFSET (looking-at "\\]"))
-       (lambda()
-         (phps-mode-lexer-yy_pop_state)
-         (phps-mode-lexer-RETURN_TOKEN "]" (match-beginning 0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_VAR_OFFSET (looking-at (concat "\\(" phps-mode-lexer-TOKENS
-                                              "\\|[{}\"`]\\)")))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (data (buffer-substring-no-properties start end)))
-           (phps-mode-lexer-RETURN_TOKEN data start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_VAR_OFFSET (looking-at (concat "[ \n\r\t'#]")))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (- (match-end 0) 1)))
-           (phps-mode-lexer-yy_pop_state)
-           (phps-mode-lexer-RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE start 
end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and (or ST_IN_SCRIPTING ST_VAR_OFFSET) (looking-at 
phps-mode-lexer-LABEL))
-       (lambda()
-         ;; (message "Adding T_STRING from %s to %s" (match-beginning 0) 
(match-end 0))
-         (phps-mode-lexer-RETURN_TOKEN 'T_STRING (match-beginning 0) 
(match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\\(#\\|//\\)"))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (_data (buffer-substring-no-properties start end))
-                (line (buffer-substring-no-properties end 
(line-end-position))))
-           (if (string-match "\\?>" line)
-               (progn
-                 (phps-mode-lexer-RETURN_TOKEN 'T_COMMENT start (+ end 
(match-beginning 0))))
-             (progn
-               ;; TODO Handle expecting values here
-               ;; (message "Found comment 2 from %s to %s" start 
(line-end-position))
-               (phps-mode-lexer-RETURN_TOKEN 'T_COMMENT start 
(line-end-position)))))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "\\(/\\*\\|/\\*\\*"
-              phps-mode-lexer-WHITESPACE
-              "\\)")))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (_data (buffer-substring-no-properties start end))
-                (doc-com (looking-at-p (concat "/\\*\\*" 
phps-mode-lexer-WHITESPACE))))
-           (let ((string-start (search-forward "*/" nil t)))
-             (if string-start
-                 (if doc-com
-                     (phps-mode-lexer-RETURN_TOKEN 'T_DOC_COMMENT start 
(match-end 0))
-                   (phps-mode-lexer-RETURN_TOKEN 'T_COMMENT start (match-end 
0)))
-               (progn
-                 (signal
-                  'phps-mode
-                  (list (format
-                         "PHPs Lexer Error - Unterminated comment starting at 
%d"
-                         (point))
-                        (point)
-                        ))))))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at (concat "\\?>" phps-mode-lexer-NEWLINE 
"?")))
-       (lambda()
-         (let ((start (match-beginning 0))
-               (end (match-end 0)))
-           (when (= (- end start) 3)
-             (setq end (1- end)))
-           (phps-mode-lexer-BEGIN 'ST_INITIAL)
-           (when (phps-mode-wy-macros-CG 'PARSER_MODE)
-             (phps-mode-lexer-RETURN_TOKEN ";" start end))
-           (phps-mode-lexer-RETURN_TOKEN 'T_CLOSE_TAG start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "'"))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (_data (buffer-substring-no-properties start end))
-                (un-escaped-end (phps-mode-lexer--get-next-unescaped "'")))
-           (if un-escaped-end
-               (progn
-                 (phps-mode-lexer-RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING 
start un-escaped-end))
-             (progn
-               ;; Unclosed single quotes
-               (phps-mode-lexer-RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE start 
(point-max))
-               (phps-mode-lexer-MOVE_FORWARD (point-max)))))))
-
-      ;; Double quoted string
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "\""))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (_data (buffer-substring-no-properties start end))
-                (open-quote t))
-
-           ;; Move forward from the double-quote
-           (forward-char)
-
-           (while open-quote
-             (let ((string-start
-                    (search-forward-regexp
-                     (concat
-                      "\\(\""
-                      "\\|\\$" phps-mode-lexer-LABEL
-                      "\\|\\${" phps-mode-lexer-LABEL
-                      "\\|{\\$" phps-mode-lexer-LABEL "\\)")
-                     nil t)))
-
-               ;; Do we find a ending double quote or starting variable?
-               (if string-start
-                   (let ((string-start (match-beginning 0))
-                         (is-escaped nil))
-
-                     ;; Go to character before match start
-                     (goto-char (1- string-start))
-
-                     ;; Store whether character is escaped or not
-                     (setq is-escaped (looking-at-p "\\\\"))
-
-                     ;; Do we find variable inside quote?
-                     (goto-char string-start)
-
-                     ;; Process character if it's not escaped
-                     (if is-escaped
-                         (forward-char 1)
-                       (setq open-quote nil)
-                       (if (looking-at "\"")
-                           (let ((_double-quoted-string 
(buffer-substring-no-properties start (+ string-start 1))))
-                             ;; (message "Double quoted string: %s" 
_double-quoted-string)
-                             (phps-mode-lexer-RETURN_TOKEN 
'T_CONSTANT_ENCAPSED_STRING start (+ string-start 1)))
-                         ;; (message "Found variable after '%s'" 
(buffer-substring-no-properties start string-start))
-                         (phps-mode-lexer-BEGIN 'ST_DOUBLE_QUOTES)
-                         (phps-mode-lexer-RETURN_TOKEN "\"" start (1+ start))
-                         (phps-mode-lexer-RETURN_TOKEN 
'T_ENCAPSED_AND_WHITESPACE (1+ start) string-start))))
-                 (progn
-                   (signal 'error (list
-                                   (format "Found no ending of quote at %s" 
start)
-                                   start))
-                   (setq open-quote nil))))))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING
-            (looking-at
-             (concat
-              "<<<"
-              phps-mode-lexer-TABS_AND_SPACES
-              "\\("
-              phps-mode-lexer-LABEL
-              "\\|'"
-              phps-mode-lexer-LABEL
-              "'\\|\""
-              phps-mode-lexer-LABEL
-              "\"\\)"
-              phps-mode-lexer-NEWLINE)))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (match-end 0))
-                (data (buffer-substring-no-properties (match-beginning 1) 
(match-end 1)))
-                (heredoc_label))
-
-           ;; Determine if it's HEREDOC or NOWDOC and extract label here
-           (if (string= (substring data 0 1) "'")
-               (progn
-                 (setq heredoc_label (substring data 1 (- (length data) 1)))
-                 (phps-mode-lexer-BEGIN 'ST_NOWDOC))
-             (progn
-               (if (string= (substring data 0 1) "\"")
-                   (setq heredoc_label (substring data 1 (- (length data) 1)))
-                 (setq heredoc_label data))
-               (phps-mode-lexer-BEGIN 'ST_HEREDOC)))
-
-           ;; Check for ending label on the next line
-           (when (string= (buffer-substring-no-properties end (+ end (length 
heredoc_label))) heredoc_label)
-             (phps-mode-lexer-BEGIN 'ST_END_HEREDOC))
-
-           (push heredoc_label phps-mode-lexer-heredoc_label_stack)
-           ;; (message "Found heredoc or nowdoc at %s with label %s" data 
heredoc_label)
-
-           (phps-mode-lexer-RETURN_TOKEN 'T_START_HEREDOC start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_IN_SCRIPTING (looking-at "[`]"))
-       (lambda()
-         ;; (message "Begun backquote at %s-%s" (match-beginning 0) (match-end 
0))
-         (phps-mode-lexer-BEGIN 'ST_BACKQUOTE)
-         (phps-mode-lexer-RETURN_TOKEN "`" (match-beginning 0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_END_HEREDOC (looking-at (concat phps-mode-lexer-ANY_CHAR)))
-       (lambda()
-         (let* ((start (match-beginning 0))
-                (end (+ start (length heredoc_label) 1))
-                (_data (buffer-substring-no-properties start end)))
-           ;; (message "Found ending heredoc at %s, %s of %s" _data 
(thing-at-point 'line) heredoc_label)
-           (pop phps-mode-lexer-heredoc_label_stack)
-           (phps-mode-lexer-BEGIN 'ST_IN_SCRIPTING)
-           (phps-mode-lexer-RETURN_TOKEN 'T_END_HEREDOC start end))))
-
-      (phps-mode-lexer-re2c-rule
-       (and (or ST_DOUBLE_QUOTES ST_BACKQUOTE ST_HEREDOC) (looking-at (concat 
"{\\$")))
-       (lambda()
-         (phps-mode-lexer-yy_push_state 'ST_IN_SCRIPTING)
-         (phps-mode-lexer-RETURN_TOKEN 'T_CURLY_OPEN (match-beginning 0) (- 
(match-end 0) 1))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_DOUBLE_QUOTES (looking-at "[\"]"))
-       (lambda()
-         (phps-mode-lexer-BEGIN 'ST_IN_SCRIPTING)
-         ;; (message "Ended double-quote at %s" (match-beginning 0))
-         (phps-mode-lexer-RETURN_TOKEN "\"" (match-beginning 0) (match-end 
0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_BACKQUOTE (looking-at "[`]"))
-       (lambda()
-         (phps-mode-lexer-BEGIN 'ST_IN_SCRIPTING)
-         (phps-mode-lexer-RETURN_TOKEN "`" (match-beginning 0) (match-end 0))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_DOUBLE_QUOTES (looking-at phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         (let ((start (point)))
-           (let ((string-start (search-forward-regexp "[^\\\\]\"" nil t)))
-             (if string-start
-                 (let* ((end (- (match-end 0) 1))
-                        (double-quoted-string (buffer-substring-no-properties 
start end)))
-                   ;; Do we find variable inside quote?
-                   (if (or (string-match (concat "\\${" phps-mode-lexer-LABEL) 
double-quoted-string)
-                           (string-match (concat "{\\$" phps-mode-lexer-LABEL) 
double-quoted-string)
-                           (string-match (concat "\\$" phps-mode-lexer-LABEL) 
double-quoted-string))
-                       (progn
-                         (let ((variable-start (+ start (match-beginning 0))))
-
-                           ;; (message "Found starting expression inside 
double-quoted string at: %s %s" start variable-start)
-                           (phps-mode-lexer-RETURN_TOKEN 
'T_CONSTANT_ENCAPSED_STRING start variable-start)
-                           ))
-                     (progn
-                       (phps-mode-lexer-RETURN_TOKEN 
'T_CONSTANT_ENCAPSED_STRING start end)
-                       ;; (message "Found end of quote at %s-%s, moving ahead 
after '%s'" start end (buffer-substring-no-properties start end))
-                       )))
-               (progn
-                 (signal 'error (list
-                                 (format "Found no ending of double quoted 
region starting at %d" start)
-                                 start))))))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_BACKQUOTE (looking-at phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         (let ((string-start (search-forward-regexp "\\([^\\\\]`\\|\\$\\|{\\)" 
nil t)))
-           (if string-start
-               (let ((start (- (match-end 0) 1)))
-                 ;; (message "Skipping backquote forward over %s" 
(buffer-substring-no-properties old-start start))
-                 (phps-mode-lexer-RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING 
old-start start)
-                 )
-             (progn
-               (signal 'error (list
-                               (format "Found no ending of back-quoted string 
starting at %d" (point))
-                               (point))))))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_HEREDOC (looking-at phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         ;; Check for $, ${ and {$ forward
-         (let ((string-start
-                (search-forward-regexp
-                 (concat
-                  "\\(\n"
-                  heredoc_label
-                  ";?\n\\|\\$"
-                  phps-mode-lexer-LABEL
-                  "\\|{\\$"
-                  phps-mode-lexer-LABEL
-                  "\\|\\${"
-                  phps-mode-lexer-LABEL
-                  "\\)"
-                  ) nil t)))
-           (if string-start
-               (let* ((start (match-beginning 0))
-                      (end (match-end 0))
-                      (data (buffer-substring-no-properties start end)))
-                 ;; (message "Found something ending at %s" data)
-
-                 (cond
-
-                  ((string-match (concat "\n" heredoc_label ";?\n") data)
-                                        ;, (message "Found heredoc end at 
%s-%s" start end)
-                   (phps-mode-lexer-BEGIN 'ST_END_HEREDOC)
-                   (phps-mode-lexer-RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE 
old-start start))
-
-                  (t
-                   ;; (message "Found variable at '%s'.. Skipping forward to 
%s" data start)
-                   (phps-mode-lexer-RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE 
old-start start)
-                   )
-
-                  ))
-             (progn
-               (signal 'error (list
-                               (format "Found no ending of heredoc at %d" 
(point))
-                               (point))))))))
-
-      (phps-mode-lexer-re2c-rule
-       (and ST_NOWDOC (looking-at phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         (let ((string-start (search-forward-regexp (concat "\n" heredoc_label 
";?\\\n") nil t)))
-           (if string-start
-               (let* ((start (match-beginning 0))
-                      (end (match-end 0))
-                      (_data (buffer-substring-no-properties start end)))
-                 ;; (message "Found something ending at %s" _data)
-                 ;; (message "Found nowdoc end at %s-%s" start end)
-                 (phps-mode-lexer-BEGIN 'ST_END_HEREDOC)
-                 (phps-mode-lexer-RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE 
old-start start)
-                 )
-             (progn
-               (signal 'error (list
-                               (format "Found no ending of newdoc starting at 
%d" (point))
-                               (point))))))))
-
-      (phps-mode-lexer-re2c-rule
-       (and (or ST_IN_SCRIPTING ST_VAR_OFFSET) (looking-at 
phps-mode-lexer-ANY_CHAR))
-       (lambda()
-         (signal 'error (list
-                         (format "Unexpected character at %d" (point))
-                         (point)))))
-
-      (phps-mode-lexer-re2c-execute))))
-
-(define-lex phps-mode-analyzer-lex
-  "Call lexer analyzer action."
-  phps-mode-analyzer-lexer
-  semantic-lex-default-action)
-
-(define-lex phps-mode-analyzer-re2c-lex
-  "Call lexer analyzer action."
-  phps-mode-analyzer-re2c-lexer
-  semantic-lex-default-action)
-
-(defun phps-mode-lexer--get-next-unescaped (character)
-  "Find where next un-escaped CHARACTER comes, if none is found return nil."
-  ;; (message "phps-mode-lexer--get-next-unescaped(%s)" character)
-  (let ((escaped nil)
-        (pos nil))
-    (while (and (not pos)
-                (< (point) (point-max)))
-      (progn
-        ;; (message "Setting forward one %s vs %s" (point) (point-max))
-        (forward-char)
-        (if (and (not escaped)
-                 (looking-at-p character))
-            (setq pos (1+ (point)))
-          (if (looking-at-p "\\\\")
-              (setq escaped (not escaped))
-            (setq escaped nil)))))
-    pos))
-
-(defun phps-mode-lexer-setup (start end)
-  "Just prepare other lexers for lexing region START to END."
-  (phps-mode-debug-message (message "Lexer setup %s - %s" start end))
-  (unless phps-mode-lexer-STATE
-    (phps-mode-lexer-BEGIN 'ST_INITIAL)))
-
-(defun phps-mode-lexer-run ()
+(defun phps-mode-lex-analyzer--re2c-run (&optional force-synchronous)
   "Run lexer."
   (interactive)
+  (require 'phps-mode-macros)
   (phps-mode-debug-message (message "Lexer run"))
 
   (let ((buffer-name (buffer-name))
-        (buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
+        (buffer-contents (buffer-substring-no-properties (point-min) 
(point-max)))
+        (async (and (boundp 'phps-mode-async-process)
+                    phps-mode-async-process))
+        (async-by-process (and (boundp 'phps-mode-async-process-using-async-el)
+                               phps-mode-async-process-using-async-el)))
+    (when force-synchronous
+      (setq async nil))
     (phps-mode-serial-commands
      buffer-name
-     (lambda() (phps-mode-analyzer-lex-string buffer-contents))
+     (lambda() (phps-mode-lex-analyzer--lex-string buffer-contents))
      (lambda(result)
-        (with-current-buffer buffer-name
-
-          ;; Move variables into this buffers variables
-          (setq-local phps-mode-lexer-tokens (nth 0 result))
-          (setq-local phps-mode-lexer-states (nth 1 result))
-          (setq-local phps-mode-lexer-STATE (nth 2 result))
-          (setq-local phps-mode-lexer-state_stack (nth 3 result))
-          (setq-local phps-mode-functions-processed-buffer nil)
-          (phps-mode-analyzer--reset-imenu)
-
-          ;; Apply syntax color on tokens
-          (dolist (token phps-mode-lexer-tokens)
-            (let ((start (car (cdr token)))
-                  (end (cdr (cdr token)))
-                  (token-name (car token)))
-              (let ((token-syntax-color 
(phps-mode-lexer-get-token-syntax-color token-name)))
-                (if token-syntax-color
-                    (phps-mode-lexer-set-region-syntax-color start end 
token-syntax-color)
-                  (phps-mode-lexer-clear-region-syntax-color start end)))))
-
-          (let ((errors (nth 4 result))
-                (error-start)
-                (error-end))
-            (when errors
-              (display-warning 'phps-mode (format "Lex Errors: %s" (car 
errors)) :debug)
-              (setq error-start (car (cdr errors)))
-              (when error-start
-                (if (car (cdr (cdr errors)))
-                    (progn
-                      (setq error-end (car (cdr (cdr (cdr errors)))))
-                      (phps-mode-lexer-set-region-syntax-color
-                       error-start
-                       error-end
-                       (list 'font-lock-face 'font-lock-warning-face)))
-                  (setq error-end (point-max))
-                  (phps-mode-lexer-set-region-syntax-color
-                   error-start
-                   error-end
-                   (list 'font-lock-face 'font-lock-warning-face)))))))))))
-
-(defun phps-mode-analyzer-lex-string (contents &optional start end states 
state state-stack tokens)
-  "Run lexer on CONTENTS."
-  ;; Create a separate buffer, run lexer inside of it, catch errors and return 
them
-  ;; to enable nice presentation
-  (let ((errors))
-    (let ((buffer (generate-new-buffer "*PHPs Lexer*")))
+       (when (get-buffer buffer-name)
+         (with-current-buffer buffer-name
+
+           ;; Move variables into this buffers variables
+           (setq phps-mode-lex-analyzer--tokens (nth 0 result))
+           (setq phps-mode-lex-analyzer--states (nth 1 result))
+           (setq phps-mode-lex-analyzer--state (nth 2 result))
+           (setq phps-mode-lex-analyzer--state-stack (nth 3 result))
+           (setq phps-mode-lex-analyzer--processed-buffer-p nil)
+           (phps-mode-lex-analyzer--reset-imenu)
+
+           ;; Apply syntax color on tokens
+           (dolist (token phps-mode-lex-analyzer--tokens)
+             (let ((start (car (cdr token)))
+                   (end (cdr (cdr token)))
+                   (token-name (car token)))
+               (let ((token-syntax-color 
(phps-mode-lex-analyzer--get-token-syntax-color token-name)))
+                 (if token-syntax-color
+                     (phps-mode-lex-analyzer--set-region-syntax-color start 
end token-syntax-color)
+                   (phps-mode-lex-analyzer--clear-region-syntax-color start 
end)))))
+
+           (let ((errors (nth 4 result))
+                 (error-start)
+                 (error-end))
+             (when errors
+               (setq error-start (car (cdr errors)))
+               (when error-start
+                 (if (car (cdr (cdr errors)))
+                     (progn
+                       (setq error-end (car (cdr (cdr (cdr errors)))))
+                       (phps-mode-lex-analyzer--set-region-syntax-color
+                        error-start
+                        error-end
+                        (list 'font-lock-face 'font-lock-warning-face)))
+                   (setq error-end (point-max))
+                   (phps-mode-lex-analyzer--set-region-syntax-color
+                    error-start
+                    error-end
+                    (list 'font-lock-face 'font-lock-warning-face))))
+               (signal 'error (list (format "Lex Errors: %s" (car 
errors)))))))))
+     async
+     async-by-process)))
+
+(defun phps-mode-lex-analyzer--incremental-lex-string
+    (buffer-name buffer-contents incremental-start-new-buffer point-max
+                 head-states incremental-state incremental-state-stack 
head-tokens &optional force-synchronous)
+  "Incremental lex region."
+  (let ((async (and (boundp 'phps-mode-async-process)
+                    phps-mode-async-process))
+        (async-by-process (and (boundp 'phps-mode-async-process-using-async-el)
+                               phps-mode-async-process-using-async-el)))
+    (when force-synchronous
+      (setq async nil))
+    (phps-mode-serial-commands
+     buffer-name
+     (lambda() (phps-mode-lex-analyzer--lex-string
+                buffer-contents
+                incremental-start-new-buffer
+                point-max
+                head-states
+                incremental-state
+                incremental-state-stack
+                head-tokens))
+     (lambda(result)
+       (when (get-buffer buffer-name)
+         (with-current-buffer buffer-name
+
+           (phps-mode-debug-message
+            (message "Incrementally-lexed-string: %s" result))
+
+           (setq phps-mode-lex-analyzer--tokens (nth 0 result))
+           (setq phps-mode-lex-analyzer--states (nth 1 result))
+           (setq phps-mode-lex-analyzer--state (nth 2 result))
+           (setq phps-mode-lex-analyzer--state-stack (nth 3 result))
+           (setq phps-mode-lex-analyzer--processed-buffer-p nil)
+           (phps-mode-lex-analyzer--reset-imenu)
+
+           ;; Apply syntax color on tokens
+           (dolist (token phps-mode-lex-analyzer--tokens)
+             (let ((start (car (cdr token)))
+                   (end (cdr (cdr token)))
+                   (token-name (car token)))
+
+               ;; Apply syntax color on token
+               (let ((token-syntax-color 
(phps-mode-lex-analyzer--get-token-syntax-color token-name)))
+                 (if token-syntax-color
+                     (phps-mode-lex-analyzer--set-region-syntax-color start 
end token-syntax-color)
+                   (phps-mode-lex-analyzer--clear-region-syntax-color start 
end)))))
+
+           (let ((errors (nth 4 result))
+                 (error-start)
+                 (error-end))
+             (when errors
+               (setq error-start (car (cdr errors)))
+               (when error-start
+                 (if (car (cdr (cdr errors)))
+                     (progn
+                       (setq error-end (car (cdr (cdr (cdr errors)))))
+                       (phps-mode-lex-analyzer--set-region-syntax-color
+                        error-start
+                        error-end
+                        (list 'font-lock-face 'font-lock-warning-face)))
+                   (setq error-end (point-max))
+                   (phps-mode-lex-analyzer--set-region-syntax-color
+                    error-start
+                    error-end
+                    (list 'font-lock-face 'font-lock-warning-face))))
+               (signal 'error (list (format "Incremental Lex Errors: %s" (car 
errors))))))
 
-      ;; Create temporary buffer and run lexer in it
-      (save-excursion
-        (switch-to-buffer buffer)
-        (insert contents)
+           (phps-mode-debug-message
+            (message "Incremental tokens: %s" incremental-tokens)))))
+     async
+     async-by-process)))
 
-        (if states
-            (setq-local phps-mode-lexer-states states)
-          (setq-local phps-mode-lexer-states nil))
-        (if state-stack
-            (setq-local phps-mode-lexer-state_stack state-stack)
-          (setq-local phps-mode-lexer-state_stack nil))
-        (if state
-            (setq-local phps-mode-lexer-STATE state)
-          (phps-mode-lexer-BEGIN 'ST_INITIAL))
+(define-lex phps-mode-lex-analyzer--cached-lex
+  "Call lexer analyzer action."
+  phps-mode-lex-analyzer--cached-lex-analyzer
+  semantic-lex-default-action)
 
-        (when (boundp 'phps-mode-syntax-table)
-          (setq-local semantic-lex-syntax-table phps-mode-syntax-table))
-        (when (fboundp 'phps-mode-analyzer-re2c-lex)
-          (setq-local semantic-lex-analyzer #'phps-mode-analyzer-re2c-lex))
-
-        ;; Catch any potential errors
-        (condition-case conditions
-            (progn
-              (if (and start end)
-                  (progn
-                    (phps-mode-debug-message
-                     (message "Running (semantic-lex %s %s)" start end))
-                    (let ((incremental-tokens (semantic-lex start end)))
-                      (setq-local phps-mode-lexer-tokens (append tokens 
incremental-tokens))))
-                (phps-mode-debug-message
-                 (message "Running (semantic-lex-buffer)"))
-                (setq-local phps-mode-lexer-tokens (semantic-lex-buffer))))
-          (error
-           (setq errors (cdr conditions))))
-
-        ;; Move variables outside of buffer
-        (setq state phps-mode-lexer-STATE)
-        (setq state-stack phps-mode-lexer-state_stack)
-        (setq states phps-mode-lexer-states)
-        (setq tokens phps-mode-lexer-tokens)
-        (kill-buffer)))
-    (list tokens states state state-stack errors)))
+(define-lex phps-mode-lex-analyzer--re2c-lex
+  "Call lexer analyzer action."
+  phps-mode-lex-analyzer--re2c-lex-analyzer
+  semantic-lex-default-action)
 
-(defun phps-mode-lexer-move-states (start diff)
+(defun phps-mode-lex-analyzer--move-states (start diff)
   "Move lexer states after (or equal to) START with modification DIFF."
-  (when phps-mode-lexer-states
-    (setq-local phps-mode-lexer-states (phps-mode-lexer-get-moved-states 
phps-mode-lexer-states start diff))))
+  (when phps-mode-lex-analyzer--states
+    (setq phps-mode-lex-analyzer--states 
(phps-mode-lex-analyzer--get-moved-states phps-mode-lex-analyzer--states start 
diff))))
 
-(defun phps-mode-lexer-get-moved-states (states start diff)
+(defun phps-mode-lex-analyzer--get-moved-states (states start diff)
   "Return moved lexer STATES after (or equal to) START with modification DIFF."
   (let ((old-states states)
         (new-states '()))
@@ -2053,12 +499,12 @@
 
     new-states))
 
-(defun phps-mode-lexer-move-tokens (start diff)
+(defun phps-mode-lex-analyzer--move-tokens (start diff)
   "Update tokens with moved lexer tokens after or equal to START with 
modification DIFF."
-  (when phps-mode-lexer-tokens
-    (setq-local phps-mode-lexer-tokens (phps-mode-lexer-get-moved-tokens 
phps-mode-lexer-tokens start diff))))
+  (when phps-mode-lex-analyzer--tokens
+    (setq phps-mode-lex-analyzer--tokens 
(phps-mode-lex-analyzer--get-moved-tokens phps-mode-lex-analyzer--tokens start 
diff))))
 
-(defun phps-mode-lexer-get-moved-tokens (old-tokens start diff)
+(defun phps-mode-lex-analyzer--get-moved-tokens (old-tokens start diff)
   "Return moved lexer OLD-TOKENS positions after (or equal to) START with DIFF 
points."
   (let ((new-tokens '()))
     (when old-tokens
@@ -2078,11 +524,11 @@
               (push token new-tokens))))))
     new-tokens))
 
-(defun phps-mode-functions--reset-changes ()
+(defun phps-mode-lex-analyzer--reset-changes ()
   "Reset change."
-  (setq phps-mode-analyzer-change-min nil))
+  (setq phps-mode-lex-analyzer--change-min nil))
 
-(defun phps-mode-analyzer-process-changes (&optional buffer)
+(defun phps-mode-lex-analyzer--process-changes (&optional buffer 
force-synchronous)
   "Run incremental lexer on BUFFER.  Return list of performed operations."
   (unless buffer
     (setq buffer (current-buffer)))
@@ -2090,33 +536,33 @@
    (message "Run process changes on buffer '%s'" buffer))
   (with-current-buffer buffer
     (let ((run-full-lexer nil)
-          (old-tokens phps-mode-lexer-tokens)
-          (old-states phps-mode-lexer-states)
+          (old-tokens phps-mode-lex-analyzer--tokens)
+          (old-states phps-mode-lex-analyzer--states)
           (log '()))
 
-      (if phps-mode-analyzer-change-min
+      (if phps-mode-lex-analyzer--change-min
           (progn
             (phps-mode-debug-message
-             (message "Processing change point minimum: %s" 
phps-mode-analyzer-change-min))
+             (message "Processing change point minimum: %s" 
phps-mode-lex-analyzer--change-min))
             (let ((incremental-state nil)
                   (incremental-state-stack nil)
                   (incremental-tokens nil)
                   (head-states '())
                   (head-tokens '())
-                  (change-start phps-mode-analyzer-change-min)
-                  (incremental-start-new-buffer phps-mode-analyzer-change-min))
+                  (change-start phps-mode-lex-analyzer--change-min)
+                  (incremental-start-new-buffer 
phps-mode-lex-analyzer--change-min))
 
               ;; Reset idle timer
-              (phps-mode-functions--cancel-idle-timer)
+              (phps-mode-lex-analyzer--cancel-idle-timer)
 
               ;; Reset buffer changes minimum index
-              (phps-mode-functions--reset-changes)
+              (phps-mode-lex-analyzer--reset-changes)
 
               ;; Reset tokens and states here
-              (setq-local phps-mode-lexer-tokens nil)
-              (setq-local phps-mode-lexer-states nil)
-              (setq-local phps-mode-lexer-STATE nil)
-              (setq-local phps-mode-lexer-state_stack nil)
+              (setq phps-mode-lex-analyzer--tokens nil)
+              (setq phps-mode-lex-analyzer--states nil)
+              (setq phps-mode-lex-analyzer--state nil)
+              (setq phps-mode-lex-analyzer--state-stack nil)
 
               ;; NOTE Starts are inclusive while ends are exclusive buffer 
locations
 
@@ -2179,7 +625,7 @@
                           ;; Do partial lex from previous-token-end to 
change-stop
 
 
-                          (phps-mode-incremental-lex-string
+                          (phps-mode-lex-analyzer--incremental-lex-string
                            (buffer-name)
                            (buffer-substring-no-properties (point-min) 
(point-max))
                            incremental-start-new-buffer
@@ -2187,7 +633,8 @@
                            head-states
                            incremental-state
                            incremental-state-stack
-                           head-tokens)
+                           head-tokens
+                           force-synchronous)
 
                           (phps-mode-debug-message
                            (message "Incremental tokens: %s" 
incremental-tokens)))
@@ -2197,7 +644,7 @@
                        (message "Found no head states"))
 
                       ;; Reset processed buffer flag
-                      (phps-mode-functions-reset-processed-buffer)
+                      (phps-mode-lex-analyzer--reset-processed-buffer)
 
                       (setq run-full-lexer t)))
 
@@ -2206,7 +653,7 @@
                  (message "Found no head tokens"))
 
                 ;; Reset processed buffer flag
-                (phps-mode-functions-reset-processed-buffer)
+                (phps-mode-lex-analyzer--reset-processed-buffer)
 
                 (setq run-full-lexer t))))
         (push (list 'FOUND-NO-CHANGE-POINT-MINIMUM) log)
@@ -2214,7 +661,7 @@
          (message "Found no change point minimum"))
 
         ;; Reset processed buffer flag
-        (phps-mode-functions-reset-processed-buffer)
+        (phps-mode-lex-analyzer--reset-processed-buffer)
 
         (setq run-full-lexer t))
 
@@ -2222,112 +669,52 @@
         (push (list 'RUN-FULL-LEXER) log)
         (phps-mode-debug-message
          (message "Running full lexer"))
-        (phps-mode-lexer-run))
+        (phps-mode-lex-analyzer--re2c-run force-synchronous))
 
       log)))
 
-(defun phps-mode-incremental-lex-string (buffer-name buffer-contents 
incremental-start-new-buffer point-max head-states incremental-state 
incremental-state-stack head-tokens)
-  "Incremental lex region."
-  (phps-mode-serial-commands
-   buffer-name
-   (lambda() (phps-mode-analyzer-lex-string
-              buffer-contents
-              incremental-start-new-buffer
-              point-max
-              head-states
-              incremental-state
-              incremental-state-stack
-              head-tokens))
-   (lambda(result)
-     (with-current-buffer buffer-name
-
-       (phps-mode-debug-message
-        (message "Incrementally-lexed-string: %s" result))
-
-       (setq-local phps-mode-lexer-tokens (nth 0 result))
-       (setq-local phps-mode-lexer-states (nth 1 result))
-       (setq-local phps-mode-lexer-STATE (nth 2 result))
-       (setq-local phps-mode-lexer-state_stack (nth 3 result))
-       (setq-local phps-mode-functions-processed-buffer nil)
-       (phps-mode-analyzer--reset-imenu)
-
-       ;; Apply syntax color on tokens
-       (dolist (token phps-mode-lexer-tokens)
-         (let ((start (car (cdr token)))
-               (end (cdr (cdr token)))
-               (token-name (car token)))
-
-           ;; Apply syntax color on token
-           (let ((token-syntax-color (phps-mode-lexer-get-token-syntax-color 
token-name)))
-             (if token-syntax-color
-                 (phps-mode-lexer-set-region-syntax-color start end 
token-syntax-color)
-               (phps-mode-lexer-clear-region-syntax-color start end)))))
-
-       (let ((errors (nth 4 result))
-             (error-start)
-             (error-end))
-         (when errors
-           (display-warning 'phps-mode (format "Incremental Lex Errors: %s" 
(car errors)) :debug)
-           (setq error-start (car (cdr errors)))
-           (when error-start
-             (if (car (cdr (cdr errors)))
-                 (progn
-                   (setq error-end (car (cdr (cdr (cdr errors)))))
-                   (phps-mode-lexer-set-region-syntax-color
-                    error-start
-                    error-end
-                    (list 'font-lock-face 'font-lock-warning-face)))
-               (setq error-end (point-max))
-               (phps-mode-lexer-set-region-syntax-color
-                error-start
-                error-end
-                (list 'font-lock-face 'font-lock-warning-face))))))
-
-       (phps-mode-debug-message
-        (message "Incremental tokens: %s" incremental-tokens))))))
-
-(defun phps-mode-functions-get-processed-buffer ()
+(defun phps-mode-lex-analyzer--get-processed-buffer ()
   "Get flag for whether buffer is processed or not."
-  phps-mode-functions-processed-buffer)
+  phps-mode-lex-analyzer--processed-buffer-p)
 
-(defun phps-mode-functions-reset-processed-buffer ()
+(defun phps-mode-lex-analyzer--reset-processed-buffer ()
   "Reset flag for whether buffer is processed or not."
-  (setq-local phps-mode-functions-processed-buffer nil))
+  (setq phps-mode-lex-analyzer--processed-buffer-p nil))
 
-(defun phps-mode-functions-process-current-buffer ()
+(defun phps-mode-lex-analyzer--process-current-buffer ()
   "Process current buffer, generate indentations and Imenu, trigger 
incremental lexer if we have change."
   (interactive)
   (phps-mode-debug-message (message "Process current buffer"))
-  (when phps-mode-functions-idle-timer
+  (when phps-mode-lex-analyzer--idle-timer
     (phps-mode-debug-message
      (message "Flag buffer as not processed since changes are detected"))
-    (setq-local phps-mode-functions-processed-buffer nil)
-    (when phps-mode-analyzer-process-on-indent-and-imenu
+    (setq phps-mode-lex-analyzer--processed-buffer-p nil)
+    (when phps-mode-lex-analyzer--process-on-indent-and-imenu-p
       (phps-mode-debug-message (message "Trigger incremental lexer"))
-      (phps-mode-analyzer-process-changes)))
+      (phps-mode-lex-analyzer--process-changes)))
   (if (and
-       (not phps-mode-functions-processed-buffer)
-       (not phps-mode-functions-idle-timer))
+       (not phps-mode-lex-analyzer--processed-buffer-p)
+       (not phps-mode-lex-analyzer--idle-timer))
       (progn
         (phps-mode-debug-message (message "Buffer is not processed"))
         (let ((processed
-               (phps-mode-functions--process-tokens-in-string
-                phps-mode-lexer-tokens
+               (phps-mode-lex-analyzer--process-tokens-in-string
+                phps-mode-lex-analyzer--tokens
                 (buffer-substring-no-properties
                  (point-min)
                  (point-max)))))
           (phps-mode-debug-message (message "Processed result: %s" processed))
-          (setq-local phps-mode-functions-imenu (nth 0 processed))
-          (setq-local phps-mode-functions-lines-indent (nth 1 processed)))
-        (phps-mode-analyzer--reset-imenu)
-        (setq-local phps-mode-functions-processed-buffer t))
+          (setq phps-mode-lex-analyzer--imenu (nth 0 processed))
+          (setq phps-mode-lex-analyzer--lines-indent (nth 1 processed)))
+        (phps-mode-lex-analyzer--reset-imenu)
+        (setq phps-mode-lex-analyzer--processed-buffer-p t))
     (phps-mode-debug-message
-     (when phps-mode-functions-processed-buffer
+     (when phps-mode-lex-analyzer--processed-buffer-p
        (message "Buffer is already processed"))
-     (when phps-mode-functions-idle-timer
+     (when phps-mode-lex-analyzer--idle-timer
        (message "Not processing buffer since there are non-lexed changes")))))
 
-(defun phps-mode-functions-get-moved-lines-indent (old-lines-indents 
start-line-number diff)
+(defun phps-mode-lex-analyzer--get-moved-lines-indent (old-lines-indents 
start-line-number diff)
   "Move OLD-LINES-INDENTS from START-LINE-NUMBER with DIFF points."
   (let ((lines-indents (make-hash-table :test 'equal))
         (line-number 1))
@@ -2355,35 +742,35 @@
           (setq line-indent (gethash line-number old-lines-indents))))
       lines-indents)))
 
-(defun phps-mode-functions-move-imenu-index (start diff)
+(defun phps-mode-lex-analyzer--move-imenu-index (start diff)
   "Moved imenu from START by DIFF points."
-  (when phps-mode-functions-imenu
-    (setq-local phps-mode-functions-imenu
-                (phps-mode-functions-get-moved-imenu phps-mode-functions-imenu 
start diff))
-    (phps-mode-analyzer--reset-imenu)))
+  (when phps-mode-lex-analyzer--imenu
+    (setq phps-mode-lex-analyzer--imenu
+                (phps-mode-lex-analyzer--get-moved-imenu 
phps-mode-lex-analyzer--imenu start diff))
+    (phps-mode-lex-analyzer--reset-imenu)))
 
-(defun phps-mode-functions-move-lines-indent (start-line-number diff)
+(defun phps-mode-lex-analyzer--move-lines-indent (start-line-number diff)
   "Move lines indent from START-LINE-NUMBER with DIFF points."
-  (when phps-mode-functions-lines-indent
+  (when phps-mode-lex-analyzer--lines-indent
     ;; (message "Moving line-indent index from %s with %s" start-line-number 
diff)
-    (setq-local
-     phps-mode-functions-lines-indent
-     (phps-mode-functions-get-moved-lines-indent
-      phps-mode-functions-lines-indent
+    (setq
+     phps-mode-lex-analyzer--lines-indent
+     (phps-mode-lex-analyzer--get-moved-lines-indent
+      phps-mode-lex-analyzer--lines-indent
       start-line-number
       diff))))
 
-(defun phps-mode-functions-get-lines-indent ()
+(defun phps-mode-lex-analyzer--get-lines-indent ()
   "Return lines indent, process buffer if not done already."
-  (phps-mode-functions-process-current-buffer)
-  phps-mode-functions-lines-indent)
+  (phps-mode-lex-analyzer--process-current-buffer)
+  phps-mode-lex-analyzer--lines-indent)
 
-(defun phps-mode-functions-get-imenu ()
+(defun phps-mode-lex-analyzer--get-imenu ()
   "Return Imenu, process buffer if not done already."
-  (phps-mode-functions-process-current-buffer)
-  phps-mode-functions-imenu)
+  (phps-mode-lex-analyzer--process-current-buffer)
+  phps-mode-lex-analyzer--imenu)
 
-(defun phps-mode-functions-get-moved-imenu (old-index start diff)
+(defun phps-mode-lex-analyzer--get-moved-imenu (old-index start diff)
   "Move imenu-index OLD-INDEX beginning from START with DIFF."
   (let ((new-index '()))
 
@@ -2391,12 +778,12 @@
       (if (and (listp old-index)
                (listp (car old-index)))
           (dolist (item old-index)
-            (let ((sub-item (phps-mode-functions-get-moved-imenu item start 
diff)))
+            (let ((sub-item (phps-mode-lex-analyzer--get-moved-imenu item 
start diff)))
               (push (car sub-item) new-index)))
         (let ((item old-index))
           (let ((item-label (car item)))
             (if (listp (cdr item))
-                (let ((sub-item (phps-mode-functions-get-moved-imenu (cdr 
item) start diff)))
+                (let ((sub-item (phps-mode-lex-analyzer--get-moved-imenu (cdr 
item) start diff)))
                   (push `(,item-label . ,sub-item) new-index))
               (let ((item-start (cdr item)))
                 (when (>= item-start start)
@@ -2405,11 +792,11 @@
 
     (nreverse new-index)))
 
-(defun phps-mode-functions--get-lines-in-buffer (beg end)
+(defun phps-mode-lex-analyzer--get-lines-in-buffer (beg end)
   "Return the number of lines in buffer between BEG and END."
-  (phps-mode-functions--get-lines-in-string (buffer-substring-no-properties 
beg end)))
+  (phps-mode-lex-analyzer--get-lines-in-string (buffer-substring-no-properties 
beg end)))
 
-(defun phps-mode-functions--get-lines-in-string (string)
+(defun phps-mode-lex-analyzer--get-lines-in-string (string)
   "Return the number of lines in STRING."
   (let ((lines-in-string 0)
         (start 0))
@@ -2418,7 +805,7 @@
       (setq lines-in-string (1+ lines-in-string)))
     lines-in-string))
 
-(defun phps-mode-functions--get-inline-html-indentation
+(defun phps-mode-lex-analyzer--get-inline-html-indentation
     (
      inline-html
      indent
@@ -2515,7 +902,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
         (setq start end)))
     (list (nreverse line-indents) indent tag-level curly-bracket-level 
square-bracket-level round-bracket-level)))
 
-(defun phps-mode-functions--process-tokens-in-string (tokens string)
+(defun phps-mode-lex-analyzer--process-tokens-in-string (tokens string)
   "Generate indexes for imenu and indentation for TOKENS and STRING one pass.  
Complexity: O(n)."
   (if tokens
       (progn
@@ -2611,7 +998,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
 
           ;; Iterate through all buffer tokens from beginning to end
           (dolist (item (nreverse tokens))
-            ;; (message "Items: %s %s" item phps-mode-lexer-tokens)
+            ;; (message "Items: %s %s" item phps-mode-lex-analyzer--tokens)
             (let ((next-token (car item))
                   (next-token-start (car (cdr item)))
                   (next-token-end (cdr (cdr item)))
@@ -2625,7 +1012,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
                  incremental-line-number
                  (+
                   incremental-line-number
-                  (phps-mode-functions--get-lines-in-string
+                  (phps-mode-lex-analyzer--get-lines-in-string
                    (substring
                     string
                     (1- token-end)
@@ -2644,7 +1031,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
                  incremental-line-number
                  (+
                   incremental-line-number
-                  (phps-mode-functions--get-lines-in-string
+                  (phps-mode-lex-analyzer--get-lines-in-string
                    (substring
                     string
                     (1- next-token-start)
@@ -2821,7 +1208,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
                     (setq first-token-is-inline-html t))
 
                   (let ((inline-html-indents
-                         (phps-mode-functions--get-inline-html-indentation
+                         (phps-mode-lex-analyzer--get-inline-html-indentation
                           (substring
                            string
                            (1- token-start)
@@ -3079,7 +1466,10 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
                       (setq first-token-is-nesting-decrease t))
 
                     (phps-mode-debug-message
-                     (message "\nDecreasing alternative control structure 
nesting at %s to %s\n" token alternative-control-structure-level)))
+                     (message
+                      "\nDecreasing alternative control structure nesting at 
%s to %s\n"
+                      token
+                      alternative-control-structure-level)))
 
                   )
 
@@ -3180,7 +1570,12 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
                             (string= next-token "("))
                     (progn
                       (phps-mode-debug-message
-                       (message "Started object-operator at %s %s on level %s" 
 token next-token in-object-operator-level))
+                       (message
+                        "Started object-operator at %s %s on level %s"
+                        token
+                        next-token
+                        in-object-operator-level
+                        ))
                       (push round-bracket-level 
in-object-operator-round-bracket-level)
                       (push square-bracket-level 
in-object-operator-square-bracket-level)
                       (setq in-object-operator t)
@@ -3544,15 +1939,15 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
           (list (nreverse imenu-index) line-indents)))
     (list nil nil)))
 
-(defun phps-mode-functions-indent-line ()
+(defun phps-mode-lex-analyzer--indent-line ()
   "Indent line."
   (phps-mode-debug-message (message "Indent line"))
-  (phps-mode-functions-process-current-buffer)
-  (if phps-mode-functions-processed-buffer
-      (if phps-mode-functions-lines-indent
+  (phps-mode-lex-analyzer--process-current-buffer)
+  (if phps-mode-lex-analyzer--processed-buffer-p
+      (if phps-mode-lex-analyzer--lines-indent
           (let ((line-number (line-number-at-pos (point))))
             (phps-mode-debug-message (message "Found lines indent index, 
indenting.."))
-            (let ((indent (gethash line-number 
phps-mode-functions-lines-indent)))
+            (let ((indent (gethash line-number 
phps-mode-lex-analyzer--lines-indent)))
               (if indent
                   (progn
                     (let ((indent-sum (+ (* (car indent) tab-width) (car (cdr 
indent))))
@@ -3566,37 +1961,37 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
                       (if (not (equal indent-sum old-indentation))
                           (progn
 
-                            (setq-local phps-mode-functions-allow-after-change 
nil)
+                            (setq phps-mode-lex-analyzer--allow-after-change-p 
nil)
                             (indent-line-to indent-sum)
-                            (setq-local phps-mode-functions-allow-after-change 
t)
+                            (setq phps-mode-lex-analyzer--allow-after-change-p 
t)
 
                             (let ((indent-diff (- (current-indentation) 
old-indentation)))
 
 
                               ;; When indent is changed the trailing tokens 
and states just
                               ;; need to adjust their positions, this will 
improve speed of indent-region a lot
-                              (phps-mode-lexer-move-tokens line-start 
indent-diff)
-                              (phps-mode-lexer-move-states line-start 
indent-diff)
-                              (phps-mode-functions-move-imenu-index line-start 
indent-diff)
+                              (phps-mode-lex-analyzer--move-tokens line-start 
indent-diff)
+                              (phps-mode-lex-analyzer--move-states line-start 
indent-diff)
+                              (phps-mode-lex-analyzer--move-imenu-index 
line-start indent-diff)
 
                               (phps-mode-debug-message
-                               (message "Lexer tokens after move: %s" 
phps-mode-lexer-tokens)
-                               (message "Lexer states after move: %s" 
phps-mode-lexer-states))
+                               (message "Lexer tokens after move: %s" 
phps-mode-lex-analyzer--tokens)
+                               (message "Lexer states after move: %s" 
phps-mode-lex-analyzer--states))
 
                               ;; Reset change flag
-                              (phps-mode-functions--reset-changes)
-                              (phps-mode-functions--cancel-idle-timer))))))
-                (phps-mode-analyzer--alternative-indentation (point))
+                              (phps-mode-lex-analyzer--reset-changes)
+                              (phps-mode-lex-analyzer--cancel-idle-timer))))))
+                (phps-mode-lex-analyzer--alternative-indentation (point))
                 (phps-mode-debug-message
                  (message "Did not find indent for line, using alternative 
indentation..")))))
-        (phps-mode-analyzer--alternative-indentation (point))
+        (phps-mode-lex-analyzer--alternative-indentation (point))
         (phps-mode-debug-message
          (message "Did not find lines indent index, using alternative 
indentation..")))
-    (phps-mode-analyzer--alternative-indentation (point))
+    (phps-mode-lex-analyzer--alternative-indentation (point))
     (phps-mode-debug-message
      (message "Using alternative indentation since buffer is not processed 
yet"))))
 
-(defun phps-mode-analyzer--alternative-indentation (&optional point)
+(defun phps-mode-lex-analyzer--alternative-indentation (&optional point)
   "Apply alternative indentation at POINT here."
   (unless point
     (setq point (point)))
@@ -3637,11 +2032,11 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
 
           (unless line-is-empty
             (let* ((old-indentation (current-indentation))
-                   (current-line-starts-with-closing-bracket 
(phps-mode-analyzer--string-starts-with-closing-bracket-p current-line-string))
-                   (line-starts-with-closing-bracket 
(phps-mode-analyzer--string-starts-with-closing-bracket-p line-string))
-                   (line-ends-with-assignment 
(phps-mode-analyzer--string-ends-with-assignment-p line-string))
-                   (line-ends-with-semicolon 
(phps-mode-analyzer--string-ends-with-semicolon-p line-string))
-                   (bracket-level 
(phps-mode-analyzer--get-string-brackets-count line-string)))
+                   (current-line-starts-with-closing-bracket 
(phps-mode-lex-analyzer--string-starts-with-closing-bracket-p 
current-line-string))
+                   (line-starts-with-closing-bracket 
(phps-mode-lex-analyzer--string-starts-with-closing-bracket-p line-string))
+                   (line-ends-with-assignment 
(phps-mode-lex-analyzer--string-ends-with-assignment-p line-string))
+                   (line-ends-with-semicolon 
(phps-mode-lex-analyzer--string-ends-with-semicolon-p line-string))
+                   (bracket-level 
(phps-mode-lex-analyzer--get-string-brackets-count line-string)))
               (setq new-indentation old-indentation)
               (forward-line move-length)
 
@@ -3694,7 +2089,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
         (back-to-indentation)))
     new-indentation))
 
-(defun phps-mode-analyzer--get-string-brackets-count (string)
+(defun phps-mode-lex-analyzer--get-string-brackets-count (string)
   "Get bracket count for STRING."
   (let ((bracket-level 0)
         (start 0)
@@ -3725,76 +2120,77 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
             (setq bracket-level (- bracket-level tab-width)))))))
     bracket-level))
 
-(defun phps-mode-analyzer--string-starts-with-closing-bracket-p (string)
+(defun phps-mode-lex-analyzer--string-starts-with-closing-bracket-p (string)
   "Get bracket count for STRING."
   (string-match-p "^[\r\t ]*\\([\]{}()[]\\|<[a-zA-Z]+\\|</[a-zA-Z]+\\|/>\\)" 
string))
 
-(defun phps-mode-analyzer--string-ends-with-assignment-p (string)
+(defun phps-mode-lex-analyzer--string-ends-with-assignment-p (string)
   "Get bracket count for STRING."
   (string-match-p "[\t ]*=$" string))
 
-(defun phps-mode-analyzer--string-ends-with-semicolon-p (string)
+(defun phps-mode-lex-analyzer--string-ends-with-semicolon-p (string)
   "Get bracket count for STRING."
   (string-match-p ";$" string))
 
-(defun phps-mode-functions--cancel-idle-timer ()
+(defun phps-mode-lex-analyzer--cancel-idle-timer ()
   "Cancel idle timer."
   (phps-mode-debug-message (message "Cancelled idle timer"))
-  (when phps-mode-functions-idle-timer
-    (cancel-timer phps-mode-functions-idle-timer)
-    (setq-local phps-mode-functions-idle-timer nil)))
+  (when phps-mode-lex-analyzer--idle-timer
+    (cancel-timer phps-mode-lex-analyzer--idle-timer)
+    (setq phps-mode-lex-analyzer--idle-timer nil)))
 
-(defun phps-mode-functions--start-idle-timer ()
+(defun phps-mode-lex-analyzer--start-idle-timer ()
   "Start idle timer."
   (phps-mode-debug-message (message "Enqueued idle timer"))
   (when (boundp 'phps-mode-idle-interval)
     (let ((buffer (current-buffer)))
-      (setq-local
-       phps-mode-functions-idle-timer
+      (setq
+       phps-mode-lex-analyzer--idle-timer
        (run-with-idle-timer
         phps-mode-idle-interval
         nil
-        #'phps-mode-analyzer-process-changes buffer)))))
+        #'phps-mode-lex-analyzer--process-changes buffer)))))
 
-(defun phps-mode-analyzer--reset-imenu ()
+(defun phps-mode-lex-analyzer--reset-imenu ()
   "Reset imenu index."
   (when (and (boundp 'imenu--index-alist)
              imenu--index-alist)
-    (setq-local imenu--index-alist nil)
+    (setq imenu--index-alist nil)
     (phps-mode-debug-message (message "Cleared Imenu index"))))
 
-(defun phps-mode-functions-after-change (start stop length)
+(defun phps-mode-lex-analyzer--after-change (start stop length)
   "Track buffer change from START to STOP with LENGTH."
   (phps-mode-debug-message
    (message "After change %s - %s, length: %s" start stop length))
 
-  (if phps-mode-functions-allow-after-change
+  (if phps-mode-lex-analyzer--allow-after-change-p
       (progn
         (phps-mode-debug-message (message "After change registration is 
enabled"))
         
         ;; If we haven't scheduled incremental lexer before - do it
         (when (and (boundp 'phps-mode-idle-interval)
                    phps-mode-idle-interval
-                   (not phps-mode-functions-idle-timer))
+                   (not phps-mode-lex-analyzer--idle-timer))
 
-          (phps-mode-analyzer--reset-imenu)
-          (phps-mode-functions--start-idle-timer))
+          (phps-mode-lex-analyzer--reset-imenu)
+          (phps-mode-lex-analyzer--start-idle-timer)
+          (phps-mode-serial-commands--kill-active (buffer-name)))
 
         (when (or
-               (not phps-mode-analyzer-change-min)
-               (< start phps-mode-analyzer-change-min))
-          (setq phps-mode-analyzer-change-min start)))
+               (not phps-mode-lex-analyzer--change-min)
+               (< start phps-mode-lex-analyzer--change-min))
+          (setq phps-mode-lex-analyzer--change-min start)))
     (phps-mode-debug-message (message "After change registration is 
disabled"))))
 
-(defun phps-mode-functions-imenu-create-index ()
+(defun phps-mode-lex-analyzer--imenu-create-index ()
   "Get Imenu for current buffer."
-  (phps-mode-functions-process-current-buffer)
-  phps-mode-functions-imenu)
+  (phps-mode-lex-analyzer--process-current-buffer)
+  phps-mode-lex-analyzer--imenu)
 
-(defun phps-mode-functions-comment-region (beg end &optional _arg)
+(defun phps-mode-lex-analyzer--comment-region (beg end &optional _arg)
   "Comment region from BEG to END with optional _ARG."
   ;; Iterate tokens from beginning to end and comment out all PHP code
-  (when-let ((tokens phps-mode-lexer-tokens))
+  (when-let ((tokens phps-mode-lex-analyzer--tokens))
     (let ((token-comment-start nil)
           (token-comment-end nil)
           (in-token-comment nil)
@@ -3879,10 +2275,10 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
         (setq token-comment-start nil)
         (setq token-comment-end nil)))))
 
-(defun phps-mode-functions-uncomment-region (beg end &optional _arg)
+(defun phps-mode-lex-analyzer--uncomment-region (beg end &optional _arg)
   "Un-comment region from BEG to END with optional ARG."
   ;; Iterate tokens from beginning to end and uncomment out all commented PHP 
code
-  (when-let ((tokens phps-mode-lexer-tokens))
+  (when-let ((tokens phps-mode-lex-analyzer--tokens))
     (let ((offset 0))
       (dolist (token tokens)
         (let ((token-label (car token))
@@ -3956,6 +2352,62 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
                       "Do not un-comment comment ending at %s"
                       token-end))))))))))))
 
-(provide 'phps-mode-analyzer)
+(defun phps-mode-lex-analyzer--setup (start end)
+  "Just prepare other lexers for lexing region START to END."
+  (require 'phps-mode-macros)
+  (phps-mode-debug-message (message "Lexer setup %s - %s" start end))
+  (unless phps-mode-lex-analyzer--state
+    (setq phps-mode-lex-analyzer--state 'ST_INITIAL)))
+
+(defun phps-mode-lex-analyzer--lex-string (contents &optional start end states 
state state-stack tokens)
+  "Run lexer on CONTENTS."
+  ;; Create a separate buffer, run lexer inside of it, catch errors and return 
them
+  ;; to enable nice presentation
+  (require 'phps-mode-macros)
+  (let ((errors))
+    (let ((buffer (generate-new-buffer "*PHPs Lexer*")))
+
+      ;; Create temporary buffer and run lexer in it
+      (save-excursion
+        (switch-to-buffer buffer)
+        (insert contents)
+
+        (if tokens
+            (setq phps-mode-lexer--tokens (nreverse tokens))
+          (setq phps-mode-lexer--tokens nil))
+        (if state
+            (setq phps-mode-lexer--state state)
+          (setq phps-mode-lexer--state 'ST_INITIAL))
+        (if states
+            (setq phps-mode-lexer--states states)
+          (setq phps-mode-lexer--states nil))
+        (if state-stack
+            (setq phps-mode-lexer--state-stack state-stack)
+          (setq phps-mode-lexer--state-stack nil))
+
+        ;; Setup lexer settings
+        (when (boundp 'phps-mode-syntax-table)
+          (setq semantic-lex-syntax-table phps-mode-syntax-table))
+        (setq semantic-lex-analyzer #'phps-mode-lex-analyzer--re2c-lex)
+
+        ;; Run lexer or incremental lexer
+        (if (and start end)
+            (let ((incremental-tokens (semantic-lex start end)))
+              (setq
+               phps-mode-lex-analyzer--tokens
+               (append tokens incremental-tokens)))
+          (setq
+           phps-mode-lex-analyzer--tokens
+           (semantic-lex-buffer)))
+
+        ;; Copy variables outside of buffer
+        (setq state phps-mode-lexer--state)
+        (setq state-stack phps-mode-lexer--state-stack)
+        (setq states phps-mode-lexer--states)
+        (setq tokens (nreverse phps-mode-lexer--tokens))
+        (kill-buffer)))
+    (list tokens states state state-stack errors)))
+
+(provide 'phps-mode-lex-analyzer)
 
-;;; phps-mode-analyzer.el ends here
+;;; phps-mode-lex-analyzer.el ends here
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
new file mode 100644
index 0000000..437ef39
--- /dev/null
+++ b/phps-mode-lexer.el
@@ -0,0 +1,1395 @@
+;;; phps-mode-lexer.el -- Lexer for PHPs -*- lexical-binding: t -*-
+
+;; Copyright (C) 2018-2020  Free Software Foundation, Inc.
+
+;; This file is not part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+
+;;; Commentary:
+
+;; The idea is gathering everything directly related to the lexer in this file,
+;; any higher order meta-lexer logic goes into `phps-mode-lex-analyzer.el'.
+;;
+;; Features:
+;; * Defines the lexer for this grammar based on the Zend PHP Lexer at
+;;  `https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l'
+;;  which is using re2c.
+
+;;; Code:
+
+
+(require 'phps-mode-macros)
+(require 'phps-mode-wy-macros)
+
+(require 'semantic)
+(require 'semantic/lex)
+(require 'subr-x)
+
+
+;; INITIALIZE SETTINGS
+
+
+(phps-mode-wy-macros--CG 'PARSER_MODE t)
+(phps-mode-wy-macros--CG 'SHORT_TAGS t)
+
+
+;; SETTINGS
+
+
+;; @see https://secure.php.net/manual/en/language.types.integer.php
+(defconst phps-mode-lexer--long-limit 2147483648
+  "Limit for 32-bit integer.")
+
+(defconst phps-mode-lexer--BNUM "0b[01]+"
+  "Boolean number.")
+
+(defconst phps-mode-lexer--HNUM "0x[0-9a-fA-F]+"
+  "Hexadecimal number.")
+
+(defconst phps-mode-lexer--LNUM "[0-9]+"
+  "Long number.")
+
+(defconst phps-mode-lexer--DNUM "\\([0-9]*\\.[0-9]+\\)\\|\\([0-9]+\\.[0-9]*\\)"
+  "Double number.")
+
+(defconst phps-mode-lexer--EXPONENT_DNUM
+  (format "\\(\\(%s\\|%s\\)[eE][\\+-]?%s\\)"
+          phps-mode-lexer--LNUM
+          phps-mode-lexer--DNUM
+          phps-mode-lexer--LNUM)
+  "Exponent double number.")
+
+(defconst phps-mode-lexer--LABEL
+  "[A-Za-z_[:nonascii:]][0-9A-Za-z_[:nonascii:]]*"
+  "Labels are used for names.")
+;; NOTE original is [a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*
+;; NOTE Rebuilt for comparability with emacs-lisp
+
+(defconst phps-mode-lexer--WHITESPACE "[ \n\r\t]+"
+  "White-space.")
+
+(defconst phps-mode-lexer--TABS_AND_SPACES "[ \t]*"
+  "Tabs and white-spaces.")
+
+(defconst phps-mode-lexer--TOKENS "[][;:,.()|^&+/*=%!~$<>?@-]"
+  "Tokens.")
+;; NOTE Original is [;:,.\[\]()|^&+-/*=%!~$<>?@]
+;; NOTE The hyphen moved last since it has special meaning and to avoid it 
being interpreted as a range.
+
+(defconst phps-mode-lexer--ANY_CHAR "[^z-a]"
+  "Any character.  The Zend equivalent is [^] but is not possible in Emacs 
Lisp.")
+
+(defconst phps-mode-lexer--NEWLINE "[\n\r]"
+  "Newline characters.  The Zend equivalent is (\"\r\"|\"\n\"|\"\r\n\").")
+
+
+;; VARIABLES
+
+
+(defvar-local phps-mode-lexer--EXPECTED nil
+  "Flag whether something is expected or not.")
+
+(defvar-local phps-mode-lexer--tokens nil
+  "List of current generated tokens.")
+
+(defvar-local phps-mode-lexer--state nil
+  "Current state of lexer.")
+
+(defvar-local phps-mode-lexer--state-stack nil
+  "Current state-stack of lexer.")
+
+(defvar-local phps-mode-lexer--states nil
+  "History of state and state-stack.")
+
+(defvar-local phps-mode-lexer--heredoc-label-stack nil
+  "Stack of heredoc labels.")
+
+(defvar-local phps-mode-lexer--match-length nil
+  "Maximum match length.")
+
+(defvar-local phps-mode-lexer--match-body nil
+  "Lambda om maximum match.")
+
+(defvar-local phps-mode-lexer--match-data nil
+  "Match data.")
+
+
+;; HELPER FUNCTIONS
+
+
+(defun phps-mode-lexer--BEGIN (state)
+  "Begin STATE."
+  (setq phps-mode-lexer--state state))
+
+;; _yy_push_state
+(defun phps-mode-lexer--yy_push_state (state)
+  "Add NEW-STATE to stack and then begin state."
+  (push phps-mode-lexer--state phps-mode-lexer--state-stack)
+  (phps-mode-lexer--BEGIN state))
+
+(defun phps-mode-lexer--yy_pop_state ()
+  "Pop current state from stack."
+  (let ((old-state (pop phps-mode-lexer--state-stack)))
+    ;; (message "Going back to poppped state %s" old-state)
+    (if old-state
+        (phps-mode-lexer--BEGIN old-state)
+      (signal
+       'error
+       (list
+        (format "PHPs Lexer Error - Trying to pop last state at %d" (point))
+        (point))))))
+
+(defun phps-mode-lexer--MOVE_FORWARD (position)
+  "Move forward to POSITION."
+  (setq semantic-lex-end-point position))
+
+(defun phps-mode-lexer--yyless (points)
+  "Move lexer back POINTS."
+  (setq semantic-lex-end-point (- semantic-lex-end-point points)))
+
+(defun phps-mode-lexer--inline-char-handler ()
+  "Mimic inline_char_handler."
+  (let ((start (match-beginning 0)))
+    (let ((string-start (search-forward "<?" nil t)))
+      (if string-start
+          (phps-mode-lexer--RETURN_TOKEN 'T_INLINE_HTML start (- string-start 
2))
+        (phps-mode-lexer--RETURN_TOKEN 'T_INLINE_HTML start (point-max))))))
+
+(defun phps-mode-lexer--emit-token (token start end)
+  "Emit TOKEN with START and END."
+
+  ;; (when (and
+  ;;        (equal token 'T_INLINE_HTML)
+  ;;        phps-mode-inline-mmm-submode
+  ;;        (fboundp 'mmm-make-region))
+  ;;   (mmm-make-region phps-mode-inline-mmm-submode start end))
+
+  (semantic-lex-push-token (semantic-lex-token token start end))
+
+  (push `(,token ,start . ,end) phps-mode-lexer--tokens)
+  
+  ;; Push token start, end, lexer state and state stack to variable
+  (push
+   (list start end phps-mode-lexer--state phps-mode-lexer--state-stack)
+   phps-mode-lexer--states))
+
+(defun phps-mode-lexer--get-next-unescaped (character)
+  "Find where next un-escaped CHARACTER comes, if none is found return nil."
+  ;; (message "phps-mode-lexer--get-next-unescaped(%s)" character)
+  (let ((escaped nil)
+        (pos nil))
+    (while (and (not pos)
+                (< (point) (point-max)))
+      (progn
+        ;; (message "Setting forward one %s vs %s" (point) (point-max))
+        (forward-char)
+        (if (and (not escaped)
+                 (looking-at-p character))
+            (setq pos (1+ (point)))
+          (if (looking-at-p "\\\\")
+              (setq escaped (not escaped))
+            (setq escaped nil)))))
+    pos))
+
+;; TODO Figure out what this does
+(defun phps-mode-lexer--SKIP_TOKEN (_token _start _end)
+  "Skip TOKEN to list with START and END.")
+
+(defmacro phps-mode-lexer--match-macro (conditions &rest body)
+  "Check if CONDITIONS hold"
+  `(phps-mode-lexer--re2c-rule
+    ,conditions
+    (lambda()
+      ,@body)))
+
+(defun phps-mode-lexer--RETURN_TOKEN (token start end)
+  "Return TOKEN."
+  (phps-mode-lexer--emit-token token start end))
+
+(defun phps-mode-lexer--RETURN_OR_SKIP_TOKEN (token start end)
+  "Return TOKEN with START and END but only in parse-mode."
+  (when (phps-mode-wy-macros--CG 'PARSER_MODE)
+    (phps-mode-lexer--RETURN_TOKEN token start end)))
+
+
+;; LEXER FUNCTIONS BELOW
+
+
+(defun phps-mode-lexer--re2c-rule (condition body)
+  "Process rule with CONDITION and BODY."
+  (when condition
+    (let ((match-end (match-end 0))
+          (match-beginning (match-beginning 0)))
+      (let ((matching-length (- match-end match-beginning)))
+        (when (> matching-length 0)
+          (when (or (not phps-mode-lexer--match-length)
+                    (> matching-length phps-mode-lexer--match-length))
+            (setq phps-mode-lexer--match-length matching-length)
+            (setq phps-mode-lexer--match-body body)
+            (setq phps-mode-lexer--match-data (match-data))))))))
+
+(defun phps-mode-lexer--re2c-execute ()
+  "Execute matching body (if any)."
+  (if phps-mode-lexer--match-body
+      (progn        
+        (set-match-data phps-mode-lexer--match-data)
+        (funcall phps-mode-lexer--match-body))
+    (signal
+     'error
+     (list "Found no matching lexer rule to execute at %d" (point)))))
+
+(defun phps-mode-lexer--reset-match-data ()
+  "Reset match data."
+  (setq phps-mode-lexer--match-length 0)
+  (setq phps-mode-lexer--match-data nil)
+  (setq phps-mode-lexer--match-body nil))
+
+;; If multiple rules match, re2c prefers the longest match.
+;; If rules match the same string, the earlier rule has priority.
+;; @see http://re2c.org/manual/syntax/syntax.html
+(defun phps-mode-lexer--re2c ()
+  "Elisp port of original Zend re2c lexer."
+
+  (let ((old-start (point)))
+    (phps-mode-debug-message (message "Running lexer from %s" old-start))
+    (phps-mode-lexer--reset-match-data)
+    
+    (let ((heredoc-label (car phps-mode-lexer--heredoc-label-stack))
+          (SHEBANG (equal phps-mode-lexer--state 'SHEBANG))
+          (ST_IN_SCRIPTING (equal phps-mode-lexer--state 'ST_IN_SCRIPTING))
+          (ST_INITIAL (equal phps-mode-lexer--state 'ST_INITIAL))
+          (ST_LOOKING_FOR_PROPERTY (equal phps-mode-lexer--state 
'ST_LOOKING_FOR_PROPERTY))
+          (ST_DOUBLE_QUOTES (equal phps-mode-lexer--state 'ST_DOUBLE_QUOTES))
+          (ST_BACKQUOTE (equal phps-mode-lexer--state 'ST_BACKQUOTE))
+          (ST_HEREDOC (equal phps-mode-lexer--state 'ST_HEREDOC))
+          (ST_NOWDOC (equal phps-mode-lexer--state 'ST_NOWDOC))
+          (ST_LOOKING_FOR_VARNAME (equal phps-mode-lexer--state 
'ST_LOOKING_FOR_VARNAME))
+          (ST_END_HEREDOC (equal phps-mode-lexer--state 'ST_END_HEREDOC))
+          (ST_VAR_OFFSET (equal phps-mode-lexer--state 'ST_VAR_OFFSET)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "exit"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_EXIT (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "die"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DIE (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "fn"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_FN (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "function"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_FUNCTION (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "const"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CONST (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "return"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_RETURN (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and
+        ST_IN_SCRIPTING
+        (looking-at
+         (concat "yield" phps-mode-lexer--WHITESPACE "from" 
"[^a-zA-Z0-9_\x80-\xff]")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_YIELD_FROM (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "yield"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_YIELD (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "try"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_TRY (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "catch"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CATCH (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "finally"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_FINALLY (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "throw"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_THROW (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "if"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_IF (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "elseif"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ELSEIF (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "endif"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ENDIF (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "else"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ELSE (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "while"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_WHILE (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "endwhile"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ENDWHILE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "do"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DO (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "for"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_FOR (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "endfor"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ENDFOR (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "foreach"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_FOREACH (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "endforeach"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ENDFOREACH (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "declare"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DECLARE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "enddeclare"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ENDDECLARE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "instanceof"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_INSTANCEOF (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "as"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_AS (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "switch"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_SWITCH (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "endswitch"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ENDSWITCH (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "case"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CASE (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "default"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DEFAULT (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "break"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_BREAK (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "continue"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CONTINUE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "goto"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_GOTO (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "echo"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ECHO (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "print"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_PRINT (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "class"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CLASS (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "interface"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_INTERFACE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "trait"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_TRAIT (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "extends"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_EXTENDS (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "implements"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_IMPLEMENTS (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "->"))
+       (phps-mode-lexer--yy_push_state 'ST_LOOKING_FOR_PROPERTY)
+       (phps-mode-lexer--RETURN_TOKEN 'T_OBJECT_OPERATOR (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and (or ST_IN_SCRIPTING ST_LOOKING_FOR_PROPERTY)
+            (looking-at phps-mode-lexer--WHITESPACE))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (data (buffer-substring-no-properties start end)))
+         (if (phps-mode-wy-macros--CG 'PARSER_MODE)
+             (phps-mode-lexer--MOVE_FORWARD end)
+           (phps-mode-lexer--RETURN_TOKEN data start end))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_LOOKING_FOR_PROPERTY (looking-at "->"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_OBJECT_OPERATOR (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_LOOKING_FOR_PROPERTY (looking-at phps-mode-lexer--LABEL))
+       (let ((start (match-beginning 0))
+             (end (match-end 0)))
+         (phps-mode-lexer--yy_pop_state)
+         (phps-mode-lexer--RETURN_TOKEN 'T_STRING start end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_LOOKING_FOR_PROPERTY (looking-at phps-mode-lexer--ANY_CHAR))
+       (let ((end (match-end 0)))
+         (phps-mode-lexer--yy_pop_state)
+         ;; TODO goto restart here?
+         ;; (message "Restart here")
+         (phps-mode-lexer--MOVE_FORWARD end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "::"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_PAAMAYIM_NEKUDOTAYIM (match-beginning 
0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\\\"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_NS_SEPARATOR (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\.\\.\\."))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ELLIPSIS (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\?\\?"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_COALESCE (match-beginning 0) 
(match-end 0)
+                                      ))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "new"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_NEW (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "clone"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CLONE (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "var"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_VAR (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "("
+              phps-mode-lexer--TABS_AND_SPACES
+              "\\(int\\|integer\\)"
+              phps-mode-lexer--TABS_AND_SPACES
+              ")")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_INT_CAST (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "("
+              phps-mode-lexer--TABS_AND_SPACES
+              "\\(double\\|float\\)"
+              phps-mode-lexer--TABS_AND_SPACES
+              ")")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DOUBLE_CAST (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "("
+              phps-mode-lexer--TABS_AND_SPACES
+              "\\(real\\)"
+              phps-mode-lexer--TABS_AND_SPACES
+              ")")))
+       (when (phps-mode-wy-macros--CG 'PARSER_MODE)
+         (signal
+          'error (list
+                  (format
+                   "PHPs Lexer Error - The (real) cast is deprecated, use 
(float) instead at %d"
+                   (match-beginning 0)
+                   )
+                  (match-beginning 0)
+                  (match-end 0)))
+         (phps-mode-lexer--RETURN_TOKEN 'T_DOUBLE_CAST (match-beginning 0) 
(match-end 0))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "("
+              phps-mode-lexer--TABS_AND_SPACES
+              "\\(string\\|binary\\)"
+              phps-mode-lexer--TABS_AND_SPACES
+              ")")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_STRING_CAST (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "("
+              phps-mode-lexer--TABS_AND_SPACES
+              "array"
+              phps-mode-lexer--TABS_AND_SPACES
+              ")")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ARRAY_CAST (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "("
+              phps-mode-lexer--TABS_AND_SPACES
+              "object"
+              phps-mode-lexer--TABS_AND_SPACES
+              ")")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_OBJECT_CAST (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and
+        ST_IN_SCRIPTING
+        (looking-at (concat
+                     "("
+                     phps-mode-lexer--TABS_AND_SPACES
+                     "\\(bool\\|boolean\\)"
+                     phps-mode-lexer--TABS_AND_SPACES
+                     ")")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_BOOL_CAST (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "("
+              phps-mode-lexer--TABS_AND_SPACES
+              "unset"
+              phps-mode-lexer--TABS_AND_SPACES ")")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_UNSET_CAST (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "eval"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_EVAL (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "include"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_INCLUDE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "include_once"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_INCLUDE_ONCE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "require"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_REQUIRE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "require_once"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_REQUIRE_ONCE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "namespace"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_NAMESPACE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "use"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_USE (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "insteadof"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_INSTEADOF (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "global"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_GLOBAL (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "isset"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ISSET (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "empty"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_EMPTY (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__halt_compiler"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_HALT_COMPILER (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "static"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_STATIC (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "abstract"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ABSTRACT (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "final"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_FINAL (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "private"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_PRIVATE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "protected"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_PROTECTED (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "public"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_PUBLIC (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "unset"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_UNSET (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "=>"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DOUBLE_ARROW (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "list"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_LIST (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "array"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_ARRAY (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "callable"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CALLABLE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\+\\+"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_INC (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "--"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DEC (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "==="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_IS_IDENTICAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "!=="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_IS_NOT_IDENTICAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "=="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_IS_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\(!=\\|<>\\)"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_IS_NOT_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "<=>"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_SPACESHIP (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "<="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_IS_SMALLER_OR_EQUAL (match-beginning 
0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at ">="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_IS_GREATER_OR_EQUAL (match-beginning 
0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\+="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_PLUS_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "-="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_MINUS_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\*="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_MUL_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\*\\\\\\*="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_POW_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\*\\\\\\*"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_POW (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "/="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DIV_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\.="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CONCAT_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "%="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_MOD_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "<<="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_SL_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at ">>="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_SR_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "&="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_AND_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "|="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_OR_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\^="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_XOR_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\?\\?="))
+       (phps-mode-lexer--RETURN_TOKEN 'T_COALESCE_EQUAL (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "||"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_BOOLEAN_OR (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "&&"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_BOOLEAN_AND (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "OR"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_LOGICAL_OR (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "AND"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_LOGICAL_AND (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "XOR"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_LOGICAL_XOR (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "<<"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_SL (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at ">>"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_SR (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at phps-mode-lexer--TOKENS))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (data (buffer-substring-no-properties start end))
+              (use-brace nil))
+         ;; (message "Found token '%s'" data)
+         (if use-brace
+             (phps-mode-lexer--RETURN_TOKEN "{" start end)
+           (phps-mode-lexer--RETURN_TOKEN data start end))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "{"))
+       (phps-mode-lexer--yy_push_state 'ST_IN_SCRIPTING)
+       (phps-mode-lexer--RETURN_TOKEN "{" (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and (or ST_DOUBLE_QUOTES ST_BACKQUOTE ST_HEREDOC) (looking-at "\\${"))
+       (phps-mode-lexer--yy_push_state 'ST_LOOKING_FOR_VARNAME)
+       (phps-mode-lexer--RETURN_TOKEN 'T_DOLLAR_OPEN_CURLY_BRACES 
(match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "}"))
+       (when phps-mode-lexer--state-stack
+         (phps-mode-lexer--yy_pop_state)
+         (phps-mode-lexer--RETURN_TOKEN "}" (match-beginning 0) (match-end 
0))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_LOOKING_FOR_VARNAME (looking-at (concat phps-mode-lexer--LABEL 
"[\\[}]")))
+       (let ((start (match-beginning 0))
+             (end (- (match-end 0) 1)))
+         ;; (message "Stopped here")
+         (phps-mode-lexer--yy_pop_state)
+         (phps-mode-lexer--yy_push_state 'ST_IN_SCRIPTING)
+         (phps-mode-lexer--RETURN_TOKEN 'T_STRING_VARNAME start end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_LOOKING_FOR_VARNAME (looking-at phps-mode-lexer--ANY_CHAR))
+       (phps-mode-lexer--yy_pop_state)
+       (phps-mode-lexer--yy_push_state 'ST_IN_SCRIPTING))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at phps-mode-lexer--BNUM))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (data (buffer-substring-no-properties (+ start 2) end))
+              (long-number (string-to-number data 2)))
+         ;; (message "Binary number %s from %s" long-number data)
+         (if (> long-number phps-mode-lexer--long-limit)
+             (phps-mode-lexer--RETURN_TOKEN 'T_DNUMBER start end)
+           (phps-mode-lexer--RETURN_TOKEN 'T_LNUMBER start end))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at phps-mode-lexer--LNUM))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (data (string-to-number (buffer-substring-no-properties start 
end))))
+         ;; (message "Long number: %d" data)
+         (if (> data phps-mode-lexer--long-limit)
+             (phps-mode-lexer--RETURN_TOKEN 'T_DNUMBER start end)
+           (phps-mode-lexer--RETURN_TOKEN 'T_LNUMBER start end))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at phps-mode-lexer--HNUM))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (data (buffer-substring-no-properties (+ start 2) end))
+              (long-number (string-to-number data 16)))
+         ;; (message "Hexadecimal number %s from %s" long-number data)
+         (if (> long-number phps-mode-lexer--long-limit)
+             (phps-mode-lexer--RETURN_TOKEN 'T_DNUMBER start end)
+           (phps-mode-lexer--RETURN_TOKEN 'T_LNUMBER start end))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_VAR_OFFSET (looking-at "\\([0]\\|[1-9][0-9]*\\)"))
+       (let ((start (match-beginning 0))
+             (end (match-end 0)))
+         (phps-mode-lexer--RETURN_TOKEN 'T_NUM_STRING start end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_VAR_OFFSET (looking-at (concat "\\("
+                                              phps-mode-lexer--LNUM "\\|"
+                                              phps-mode-lexer--HNUM "\\|"
+                                              phps-mode-lexer--BNUM "\\)")))
+       (phps-mode-lexer--RETURN_TOKEN 'T_NUM_STRING (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (or (looking-at phps-mode-lexer--EXPONENT_DNUM)
+                                (looking-at phps-mode-lexer--DNUM)))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (_data (buffer-substring-no-properties start end)))
+         ;; (message "Exponent/double at: %s" _data)
+         (phps-mode-lexer--RETURN_TOKEN 'T_DNUMBER start end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__CLASS__"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_CLASS_C (match-beginning 0) 
(match-end 0))
+       )
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__TRAIT__"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_TRAIT_C (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__FUNCTION__"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_FUNC_C (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__METHOD__"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_METHOD_C (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__LINE__"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_LINE (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__FILE__"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_FILE (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__DIR__"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_DIR (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "__NAMESPACE__"))
+       (phps-mode-lexer--RETURN_TOKEN 'T_NS_C (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and SHEBANG (looking-at (concat "#!.*" phps-mode-lexer--NEWLINE)))
+       (phps-mode-lexer--BEGIN 'ST_INITIAL))
+
+      (phps-mode-lexer--match-macro
+       (and SHEBANG (looking-at phps-mode-lexer--ANY_CHAR))
+       (phps-mode-lexer--BEGIN 'ST_INITIAL))
+
+      (phps-mode-lexer--match-macro
+       (and ST_INITIAL (looking-at "<\\?="))
+       (let ((start (match-beginning 0))
+             (end (match-end 0)))
+         (phps-mode-lexer--BEGIN 'ST_IN_SCRIPTING)
+         (when (phps-mode-wy-macros--CG 'PARSER_MODE)
+           (phps-mode-lexer--RETURN_TOKEN 'T_ECHO start end))
+         (phps-mode-lexer--RETURN_TOKEN 'T_OPEN_TAG_WITH_ECHO start end)))
+
+      (phps-mode-lexer--match-macro
+       (and
+        ST_INITIAL
+        (looking-at (concat "<\\?php\\([ \t]\\|" phps-mode-lexer--NEWLINE 
"\\)")))
+       (let ((start (match-beginning 0))
+             (end (match-end 0)))
+         (phps-mode-lexer--BEGIN 'ST_IN_SCRIPTING)
+         ;; (message "Starting scripting after <?php")
+         (when phps-mode-lexer--EXPECTED
+           (phps-mode-lexer--SKIP_TOKEN 'T_OPEN_TAG start end))
+         (phps-mode-lexer--RETURN_TOKEN 'T_OPEN_TAG start end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_INITIAL (looking-at "<\\?php"))
+       (let ((start (match-beginning 0))
+             (end (match-end 0)))
+
+         ;; Allow <?php followed by end of file.
+         (cond
+
+          ((equal end (point-max))
+           (phps-mode-lexer--BEGIN 'ST_IN_SCRIPTING)
+           (phps-mode-lexer--RETURN_OR_SKIP_TOKEN
+            'T_OPEN_TAG
+            start
+            end))
+
+          ((phps-mode-wy-macros--CG 'SHORT_TAGS)
+           (phps-mode-lexer--yyless 3)
+           (setq end (- end 3))
+           (phps-mode-lexer--BEGIN 'ST_IN_SCRIPTING)
+           (phps-mode-lexer--RETURN_OR_SKIP_TOKEN
+            'T_OPEN_TAG
+            start
+            end))
+
+          (t
+           (phps-mode-lexer--inline-char-handler)))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_INITIAL (looking-at "<\\?"))
+       (when (phps-mode-wy-macros--CG 'SHORT_TAGS)
+         (let ((start (match-beginning 0))
+               (end (match-end 0)))
+           (phps-mode-lexer--BEGIN 'ST_IN_SCRIPTING)
+           (when phps-mode-lexer--EXPECTED
+             (phps-mode-lexer--SKIP_TOKEN 'T_OPEN_TAG start end))
+           ;; (message "Starting scripting after <?")
+           (phps-mode-lexer--RETURN_TOKEN 'T_OPEN_TAG start end))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_INITIAL (looking-at phps-mode-lexer--ANY_CHAR))
+       (phps-mode-lexer--inline-char-handler))
+
+      (phps-mode-lexer--match-macro
+       (and (or ST_DOUBLE_QUOTES ST_HEREDOC ST_BACKQUOTE)
+            (looking-at
+             (concat
+              "\\$"
+              phps-mode-lexer--LABEL
+              "->"
+              "[a-zA-Z_\x80-\xff]")))
+       (phps-mode-lexer--yy_push_state 'ST_LOOKING_FOR_PROPERTY)
+       (forward-char -3)
+       (phps-mode-lexer--RETURN_TOKEN 'T_VARIABLE (match-beginning 0) (- 
(match-end 0) 3)))
+
+      (phps-mode-lexer--match-macro
+       (and (or ST_DOUBLE_QUOTES ST_HEREDOC ST_BACKQUOTE)
+            (looking-at
+             (concat
+              "\\$"
+              phps-mode-lexer--LABEL
+              "\\[")))
+       (phps-mode-lexer--yy_push_state 'ST_VAR_OFFSET)
+       (phps-mode-lexer--RETURN_TOKEN 'T_VARIABLE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and (or ST_IN_SCRIPTING ST_DOUBLE_QUOTES ST_HEREDOC ST_BACKQUOTE 
ST_VAR_OFFSET)
+            (looking-at
+             (concat
+              "\\$"
+              phps-mode-lexer--LABEL)))
+       (phps-mode-lexer--RETURN_TOKEN 'T_VARIABLE (match-beginning 0) 
(match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_VAR_OFFSET (looking-at "\\]"))
+       (phps-mode-lexer--yy_pop_state)
+       (phps-mode-lexer--RETURN_TOKEN "]" (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_VAR_OFFSET (looking-at (concat "\\(" phps-mode-lexer--TOKENS
+                                              "\\|[{}\"`]\\)")))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (data (buffer-substring-no-properties start end)))
+         (phps-mode-lexer--RETURN_TOKEN data start end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_VAR_OFFSET (looking-at (concat "[ \n\r\t'#]")))
+       (let* ((start (match-beginning 0))
+              (end (- (match-end 0) 1)))
+         (phps-mode-lexer--yy_pop_state)
+         (phps-mode-lexer--RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE start end)))
+
+      (phps-mode-lexer--match-macro
+       (and (or ST_IN_SCRIPTING ST_VAR_OFFSET) (looking-at 
phps-mode-lexer--LABEL))
+       ;; (message "Adding T_STRING from %s to %s" (match-beginning 0) 
(match-end 0))
+       (phps-mode-lexer--RETURN_TOKEN 'T_STRING (match-beginning 0) (match-end 
0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\\(#\\|//\\)"))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (_data (buffer-substring-no-properties start end))
+              (line (buffer-substring-no-properties end (line-end-position))))
+         (if (string-match "\\?>" line)
+             (progn
+               (phps-mode-lexer--RETURN_TOKEN 'T_COMMENT start (+ end 
(match-beginning 0))))
+           (progn
+             ;; TODO Handle expecting values here
+             ;; (message "Found comment 2 from %s to %s" start 
(line-end-position))
+             (phps-mode-lexer--RETURN_TOKEN 'T_COMMENT start 
(line-end-position))))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "\\(/\\*\\|/\\*\\*"
+              phps-mode-lexer--WHITESPACE
+              "\\)")))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (_data (buffer-substring-no-properties start end))
+              (doc-com (looking-at-p (concat "/\\*\\*" 
phps-mode-lexer--WHITESPACE))))
+         (let ((string-start (search-forward "*/" nil t)))
+           (if string-start
+               (if doc-com
+                   (phps-mode-lexer--RETURN_TOKEN 'T_DOC_COMMENT start 
(match-end 0))
+                 (phps-mode-lexer--RETURN_TOKEN 'T_COMMENT start (match-end 
0)))
+             (progn
+               (signal
+                'error
+                (list (format
+                       "PHPs Lexer Error - Unterminated comment starting at %d"
+                       (point))
+                      (point)
+                      )))))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at (concat "\\?>" 
phps-mode-lexer--NEWLINE "?")))
+       (let ((start (match-beginning 0))
+             (end (match-end 0)))
+         (when (= (- end start) 3)
+           (setq end (1- end)))
+         (phps-mode-lexer--BEGIN 'ST_INITIAL)
+         (when (phps-mode-wy-macros--CG 'PARSER_MODE)
+           (phps-mode-lexer--RETURN_TOKEN ";" start end))
+         (phps-mode-lexer--RETURN_TOKEN 'T_CLOSE_TAG start end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "'"))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (_data (buffer-substring-no-properties start end))
+              (un-escaped-end (phps-mode-lexer--get-next-unescaped "'")))
+         (if un-escaped-end
+             (progn
+               (phps-mode-lexer--RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING 
start un-escaped-end))
+           (progn
+             ;; Unclosed single quotes
+             (phps-mode-lexer--RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE start 
(point-max))
+             (phps-mode-lexer--MOVE_FORWARD (point-max))))))
+
+      ;; Double quoted string
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "\""))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (_data (buffer-substring-no-properties start end))
+              (open-quote t))
+
+         ;; Move forward from the double-quote one character
+         (forward-char)
+
+         (while open-quote
+           (let ((string-start
+                  (search-forward-regexp
+                   (concat
+                    "\\(\""
+                    "\\|\\$" phps-mode-lexer--LABEL
+                    "\\|\\${" phps-mode-lexer--LABEL
+                    "\\|{\\$" phps-mode-lexer--LABEL "\\)")
+                   nil t)))
+
+             ;; Do we find a ending double quote or starting variable?
+             (if string-start
+                 (let ((string-start (match-beginning 0))
+                       (is-escaped nil)
+                       (is-escaped-1 nil)
+                       (is-escaped-2 nil))
+
+                   ;; Check whether one character back is escape character
+                   (goto-char (1- string-start))
+                   (setq is-escaped-1 (looking-at-p "\\\\"))
+
+                   ;; Check whether two characters back is escape character
+                   (goto-char (- string-start 2))
+                   (setq is-escaped-2 (looking-at-p "\\\\"))
+
+                   (setq is-escaped
+                         (and
+                          is-escaped-1
+                          (not is-escaped-2)))
+
+                   ;; Do we find variable inside quote?
+                   (goto-char string-start)
+
+                   ;; Process character if it's not escaped
+                   (if is-escaped
+                       (forward-char 1)
+                     (setq open-quote nil)
+                     (if (looking-at "\"")
+                         (let ((_double-quoted-string
+                                (buffer-substring-no-properties start (+ 
string-start 1))))
+                           ;; (message "Double quoted string: %s" 
_double-quoted-string)
+                           (phps-mode-lexer--RETURN_TOKEN
+                            'T_CONSTANT_ENCAPSED_STRING
+                            start
+                            (+ string-start 1)))
+                       ;; (message "Found variable after '%s' at %s-%s" 
(buffer-substring-no-properties start string-start) start string-start)
+                       (phps-mode-lexer--BEGIN 'ST_DOUBLE_QUOTES)
+                       (phps-mode-lexer--RETURN_TOKEN "\"" start (1+ start))
+                       (phps-mode-lexer--RETURN_TOKEN
+                        'T_ENCAPSED_AND_WHITESPACE
+                        (1+ start)
+                        string-start))))
+               (progn
+                 (setq open-quote nil)
+                 (signal
+                  'error
+                  (list
+                   (format "Found no ending of quote at %s" start)
+                   start))))))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING
+            (looking-at
+             (concat
+              "<<<"
+              phps-mode-lexer--TABS_AND_SPACES
+              "\\("
+              phps-mode-lexer--LABEL
+              "\\|'"
+              phps-mode-lexer--LABEL
+              "'\\|\""
+              phps-mode-lexer--LABEL
+              "\"\\)"
+              phps-mode-lexer--NEWLINE)))
+       (let* ((start (match-beginning 0))
+              (end (match-end 0))
+              (data (buffer-substring-no-properties (match-beginning 1) 
(match-end 1))))
+
+         ;; Determine if it's HEREDOC or NOWDOC and extract label here
+         (if (string= (substring data 0 1) "'")
+             (progn
+               (setq heredoc-label (substring data 1 (- (length data) 1)))
+               (phps-mode-lexer--BEGIN 'ST_NOWDOC))
+           (progn
+             (if (string= (substring data 0 1) "\"")
+                 (setq heredoc-label (substring data 1 (- (length data) 1)))
+               (setq heredoc-label data))
+             (phps-mode-lexer--BEGIN 'ST_HEREDOC)))
+
+         ;; Check for ending label on the next line
+         (when (string= (buffer-substring-no-properties end (+ end (length 
heredoc-label))) heredoc-label)
+           (phps-mode-lexer--BEGIN 'ST_END_HEREDOC))
+
+         (push heredoc-label phps-mode-lexer--heredoc-label-stack)
+         ;; (message "Found heredoc or nowdoc at %s with label %s" data 
heredoc-label)
+
+         (phps-mode-lexer--RETURN_TOKEN 'T_START_HEREDOC start end)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_IN_SCRIPTING (looking-at "[`]"))
+       ;; (message "Begun backquote at %s-%s" (match-beginning 0) (match-end 
0))
+       (phps-mode-lexer--BEGIN 'ST_BACKQUOTE)
+       (phps-mode-lexer--RETURN_TOKEN "`" (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_END_HEREDOC (looking-at (concat phps-mode-lexer--ANY_CHAR)))
+       (let* ((start (match-beginning 0))
+              (end (+ start (length heredoc-label) 1))
+              (_data (buffer-substring-no-properties start end)))
+         ;; (message "Found ending heredoc at %s, %s of %s" _data 
(thing-at-point 'line) heredoc-label)
+         (pop phps-mode-lexer--heredoc-label-stack)
+         (phps-mode-lexer--BEGIN 'ST_IN_SCRIPTING)
+         (phps-mode-lexer--RETURN_TOKEN 'T_END_HEREDOC start end)))
+
+      (phps-mode-lexer--match-macro
+       (and (or ST_DOUBLE_QUOTES ST_BACKQUOTE ST_HEREDOC) (looking-at (concat 
"{\\$")))
+       (phps-mode-lexer--yy_push_state 'ST_IN_SCRIPTING)
+       (phps-mode-lexer--RETURN_TOKEN 'T_CURLY_OPEN (match-beginning 0) (- 
(match-end 0) 1)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_DOUBLE_QUOTES (looking-at "[\"]"))
+       (phps-mode-lexer--BEGIN 'ST_IN_SCRIPTING)
+       ;; (message "Ended double-quote at %s" (match-beginning 0))
+       (phps-mode-lexer--RETURN_TOKEN "\"" (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_BACKQUOTE (looking-at "[`]"))
+       (phps-mode-lexer--BEGIN 'ST_IN_SCRIPTING)
+       (phps-mode-lexer--RETURN_TOKEN "`" (match-beginning 0) (match-end 0)))
+
+      (phps-mode-lexer--match-macro
+       (and ST_DOUBLE_QUOTES (looking-at phps-mode-lexer--ANY_CHAR))
+       (let ((start (point)))
+         (let ((string-start (search-forward-regexp "[^\\\\]\"" nil t)))
+           (if string-start
+               (let* ((end (- (match-end 0) 1))
+                      (double-quoted-string (buffer-substring-no-properties 
start end)))
+                 ;; Do we find variable inside quote?
+                 (if (or (string-match (concat "\\${" phps-mode-lexer--LABEL) 
double-quoted-string)
+                         (string-match (concat "{\\$" phps-mode-lexer--LABEL) 
double-quoted-string)
+                         (string-match (concat "\\$" phps-mode-lexer--LABEL) 
double-quoted-string))
+                     (progn
+                       (let ((variable-start (+ start (match-beginning 0))))
+
+                         ;; (message "Found starting expression inside 
double-quoted string at: %s %s" start variable-start)
+                         (phps-mode-lexer--RETURN_TOKEN 
'T_CONSTANT_ENCAPSED_STRING start variable-start)))
+                   (progn
+                     (phps-mode-lexer--RETURN_TOKEN 
'T_CONSTANT_ENCAPSED_STRING start end)
+                     ;; (message "Found end of quote at %s-%s, moving ahead 
after '%s'" start end (buffer-substring-no-properties start end))
+                     )))
+             (progn
+               (signal
+                'error
+                (list
+                 (format "Found no ending of double quoted region starting at 
%d" start)
+                 start)))))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_BACKQUOTE (looking-at phps-mode-lexer--ANY_CHAR))
+       (let ((string-start (search-forward-regexp "\\([^\\\\]`\\|\\$\\|{\\)" 
nil t)))
+         (if string-start
+             (let ((start (- (match-end 0) 1)))
+               ;; (message "Skipping backquote forward over %s" 
(buffer-substring-no-properties old-start start))
+               (phps-mode-lexer--RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING 
old-start start)
+               )
+           (progn
+             (signal
+              'error
+              (list
+               (format "Found no ending of back-quoted string starting at %d" 
(point))
+               (point)))))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_HEREDOC (looking-at phps-mode-lexer--ANY_CHAR))
+       ;; Check for $, ${ and {$ forward
+       (let ((string-start
+              (search-forward-regexp
+               (concat
+                "\\(\n"
+                heredoc-label
+                ";?\n\\|\\$"
+                phps-mode-lexer--LABEL
+                "\\|{\\$"
+                phps-mode-lexer--LABEL
+                "\\|\\${"
+                phps-mode-lexer--LABEL
+                "\\)"
+                ) nil t)))
+         (if string-start
+             (let* ((start (match-beginning 0))
+                    (end (match-end 0))
+                    (data (buffer-substring-no-properties start end)))
+               ;; (message "Found something ending at %s" data)
+
+               (cond
+
+                ((string-match (concat "\n" heredoc-label ";?\n") data)
+                 ;; (message "Found heredoc end at %s-%s" start end)
+                 (phps-mode-lexer--BEGIN 'ST_END_HEREDOC)
+                 (phps-mode-lexer--RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE 
old-start start))
+
+                (t
+                 ;; (message "Found variable at '%s'.. Skipping forward to %s" 
data start)
+                 (phps-mode-lexer--RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE 
old-start start)
+                 )
+
+                ))
+           (progn
+             (signal
+              'error
+              (list
+               (format "Found no ending of heredoc at %d" (point))
+               (point)))))))
+
+      (phps-mode-lexer--match-macro
+       (and ST_NOWDOC (looking-at phps-mode-lexer--ANY_CHAR))
+       (let ((string-start (search-forward-regexp (concat "\n" heredoc-label 
";?\\\n") nil t)))
+         (if string-start
+             (let* ((start (match-beginning 0))
+                    (end (match-end 0))
+                    (_data (buffer-substring-no-properties start end)))
+               ;; (message "Found something ending at %s" _data)
+               ;; (message "Found nowdoc end at %s-%s" start end)
+               (phps-mode-lexer--BEGIN 'ST_END_HEREDOC)
+               (phps-mode-lexer--RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE 
old-start start))
+           (progn
+             (signal
+              'error
+              (list
+               (format "Found no ending of newdoc starting at %d" (point))
+               (point)))))))
+
+      (phps-mode-lexer--match-macro
+       (and (or ST_IN_SCRIPTING ST_VAR_OFFSET) (looking-at 
phps-mode-lexer--ANY_CHAR))
+       (signal
+        'error (list
+                (format "Unexpected character at %d" (point))
+                (point))))
+
+      (when phps-mode-lexer--match-length
+        (phps-mode-lexer--re2c-execute)))))
+
+
+(provide 'phps-mode-lexer)
+
+;;; phps-mode-lexer.el ends here 
diff --git a/phps-mode-serial.el b/phps-mode-serial.el
new file mode 100644
index 0000000..945e978
--- /dev/null
+++ b/phps-mode-serial.el
@@ -0,0 +1,221 @@
+;;; phps-mode-serial.el --- Functions for synchronity -*- lexical-binding: t 
-*-
+
+;; Copyright (C) 2018-2020  Free Software Foundation, Inc.
+
+;;; Commentary:
+
+
+;;; Code:
+
+
+;; VARIABLES
+
+(defvar phps-mode-serial--async-processes (make-hash-table :test 'equal)
+  "Table of active asynchronous processes.")
+
+(defvar phps-mode-serial--async-threads (make-hash-table :test 'equal)
+  "Table of active asynchronous threads.")
+
+
+;; FUNCTIONS
+
+
+(defun phps-mode-serial-commands--kill-active (key)
+  "Kill active command KEY."
+  (when (and
+         (gethash key phps-mode-serial--async-processes)
+         (process-live-p (gethash key phps-mode-serial--async-processes)))
+    (let ((process-buffer (process-buffer (gethash key 
phps-mode-serial--async-processes))))
+      (delete-process (gethash key phps-mode-serial--async-processes))
+      (kill-buffer process-buffer)))
+  (when (and
+         (gethash key phps-mode-serial--async-threads)
+         (thread-live-p (gethash key phps-mode-serial--async-threads)))
+    (thread-signal (gethash key phps-mode-serial--async-threads) 'quit nil)))
+
+(defun phps-mode-serial-commands (key start end &optional async 
async-by-process)
+  "Run command with KEY, first START and if successfully then END with the 
result of START as argument.  Optional arguments ASYNC ASYNC-BY-PROCESS 
specifies additional opions."
+  (let ((start-time (current-time)))
+    (message "PHPs - Starting serial commands for buffer '%s'.." key)
+    (phps-mode-serial-commands--kill-active key)
+    (if async
+        (if async-by-process
+            (progn
+              (unless (fboundp 'async-start)
+                (signal 'error (list "Async-start function is missing")))
+
+              ;; Run command(s) asynchronously
+              (let ((script-filename
+                     (file-name-directory
+                      (symbol-file 'phps-mode))))
+                (puthash
+                 key
+                 (async-start
+                  (lambda()
+                    (add-to-list 'load-path script-filename)
+                    (require 'phps-mode)
+
+                    ;; Execute start lambda
+                    (condition-case conditions
+                        (progn
+                          (let ((start-return (funcall start)))
+                            (list 'success start-return start-time)))
+                      (error (list 'error conditions start-time))))
+                  (lambda (start-return)
+                    (let ((status (car start-return))
+                          (value (car (cdr start-return)))
+                          (start-time (car (cdr (cdr start-return))))
+                          (end-return nil))
+
+                      ;; Profile execution in debug mode
+                      (let* ((end-time (current-time))
+                             (end-time-float
+                              (+ (car end-time) (car (cdr end-time)) (* (car 
(cdr (cdr end-time))) 0.000001)))
+                             (start-time-float
+                              (+ (car start-time) (car (cdr start-time)) (* 
(car (cdr (cdr start-time))) 0.000001)))
+                             (elapsed (- end-time-float start-time-float)))
+                        (message "Serial asynchronous process start finished, 
elapsed: %fs" elapsed))
+
+                      (cond
+                       ((string= status "success")
+
+                        ;; Execute end lambda
+                        (condition-case conditions
+                            (progn
+                              (let ((return (funcall end value)))
+                                (setq end-return (list 'success return 
start-time))))
+                          (error (setq end-return (list 'error conditions 
start-time))))
+
+                        ;; Profile execution in debug mode
+                        (let* ((end-time (current-time))
+                               (end-time-float
+                                (+ (car end-time) (car (cdr end-time)) (* (car 
(cdr (cdr end-time))) 0.000001)))
+                               (start-time-float
+                                (+ (car start-time) (car (cdr start-time)) (* 
(car (cdr (cdr start-time))) 0.000001)))
+                               (elapsed (- end-time-float start-time-float)))
+                          (message "Serial synchronous thread finished, 
elapsed: %fs" elapsed))
+
+                        (let ((status (car end-return))
+                              (value (cdr end-return)))
+
+                          (when (string= status "error")
+                            (display-warning 'phps-mode (format "%s" (car 
value))))))
+                       ((string= status "error")
+                        (display-warning 'phps-mode (format "%s" (car 
value))))))))
+                 phps-mode-serial--async-processes)))
+
+          ;; Run command(s) asynchronously
+          (puthash
+           key
+           (make-thread
+            (lambda()
+              (let ((start-return)
+                    (end-return))
+
+                ;; First execute start lambda
+                (condition-case conditions
+                    (let ((return (funcall start)))
+                      (setq start-return (list 'success return start-time)))
+                  (error (setq start-return (list 'error conditions 
start-time))))
+
+                ;; Profile execution in debug mode
+                (let* ((end-time (current-time))
+                       (end-time-float
+                        (+ (car end-time) (car (cdr end-time)) (* (car (cdr 
(cdr end-time))) 0.000001)))
+                       (start-time-float
+                        (+ (car start-time) (car (cdr start-time)) (* (car 
(cdr (cdr start-time))) 0.000001)))
+                       (elapsed (- end-time-float start-time-float)))
+                  (message "Serial asynchronous thread start finished, 
elapsed: %fs" elapsed))
+
+                ;; (setq start-time (current-time))
+
+                (let ((status (car start-return))
+                      (value (car (cdr start-return)))
+                      (start-time (car (cdr (cdr start-return)))))
+
+                  (when (string= status "success")
+                    
+                    ;; Then execute end lambda
+                    (condition-case conditions
+                        (let ((return (funcall end value)))
+                          (setq end-return (list 'success return start-time)))
+                      (error (setq end-return (list 'error conditions 
start-time))))
+
+                    ;; Profile execution
+                    (let* ((end-time (current-time))
+                           (end-time-float
+                            (+ (car end-time) (car (cdr end-time)) (* (car 
(cdr (cdr end-time))) 0.000001)))
+                           (start-time-float
+                            (+ (car start-time) (car (cdr start-time)) (* (car 
(cdr (cdr start-time))) 0.000001)))
+                           (elapsed (- end-time-float start-time-float)))
+                      (message "Serial asynchronous thread end finished, 
elapsed: %fs" elapsed))
+
+                    (let ((status (car end-return))
+                          (value (car (cdr end-return))))
+
+                      (when (string= status "error")
+                        (display-warning 'phps-mode (format "%s" (car 
value)))))
+
+                    (when (string= status "error")
+                      (display-warning 'phps-mode (format "%s" (car 
value))))))))
+            key)
+           phps-mode-serial--async-threads))
+
+      (let ((start-return)
+            (end-return))
+
+        ;; Run start and catch potential errors
+        (condition-case conditions
+            (progn
+              (let ((return (funcall start)))
+                (setq start-return (list 'success return start-time))))
+          (error (setq start-return (list 'error conditions start-time))))
+
+        ;; Profile execution in debug mode
+        (let* ((end-time (current-time))
+               (end-time-float
+                (+ (car end-time) (car (cdr end-time)) (* (car (cdr (cdr 
end-time))) 0.000001)))
+               (start-time-float
+                (+ (car start-time) (car (cdr start-time)) (* (car (cdr (cdr 
start-time))) 0.000001)))
+               (elapsed (- end-time-float start-time-float)))
+          (message "Serial synchronous thread start finished, elapsed: %fs" 
elapsed))
+
+        (let ((status (car start-return))
+              (value (car (cdr start-return)))
+              (start-time (car (cdr (cdr start-return)))))
+
+          ;; (message "Return: %s" start-return)
+
+          (when (string= status "success")
+
+            ;; (setq start-time (current-time))
+
+            ;; Then execute end lambda
+            (condition-case conditions
+                (let ((return (funcall end value)))
+                  (setq end-return (list 'success return start-time)))
+              (error (setq end-return (list 'error conditions start-time))))
+
+            ;; Profile execution in debug mode
+            (let* ((end-time (current-time))
+                   (end-time-float
+                    (+ (car end-time) (car (cdr end-time)) (* (car (cdr (cdr 
end-time))) 0.000001)))
+                   (start-time-float
+                    (+ (car start-time) (car (cdr start-time)) (* (car (cdr 
(cdr start-time))) 0.000001)))
+                   (elapsed (- end-time-float start-time-float)))
+              (message "Serial synchronous thread end finished, elapsed: %fs" 
elapsed))
+
+            (let ((status (car end-return))
+                  (value (car (cdr end-return))))
+
+              ;; (message "End-status: '%s' value: '%s'" status value)
+
+              (when (string= status "error")
+                (display-warning 'phps-mode (format "%s" (car value))))))
+
+          (when (string= status "error")
+            (display-warning 'phps-mode (format "%s" (car value)))))))))
+
+
+(provide 'phps-mode-serial)
+;;; phps-mode-serial.el ends here
diff --git a/phps-mode-test.el b/phps-mode-test.el
index 6300072..0f246af 100644
--- a/phps-mode-test.el
+++ b/phps-mode-test.el
@@ -27,7 +27,7 @@
 (require 'phps-mode)
 (require 'phps-mode-macros)
 
-(defmacro phps-mode-test-incremental-vs-intial-buffer (source &optional title 
&rest change)
+(defmacro phps-mode-test--incremental-vs-intial-buffer (source &optional title 
&rest change)
   "Set up test buffer with SOURCE, TITLE, apply CHANGE and compare incremental 
values with initial values."
   `(let ((test-buffer-incremental (generate-new-buffer "test-incremental"))
          (incremental-states nil)
@@ -50,12 +50,12 @@
        (message "\nTesting incremental buffer '%s':\n'%s'\n" ,title ,source))
      (phps-mode)
      ,@change
-     (phps-mode-analyzer-process-changes test-buffer-incremental)
-     (phps-mode-functions-process-current-buffer)
-     (setq incremental-states phps-mode-lexer-states)
-     (setq incremental-tokens phps-mode-lexer-tokens)
-     (setq incremental-imenu phps-mode-functions-imenu)
-     (setq incremental-indent (phps-mode-test-hash-to-list 
phps-mode-functions-lines-indent))
+     (phps-mode-lex-analyzer--process-changes test-buffer-incremental)
+     (phps-mode-lex-analyzer--process-current-buffer)
+     (setq incremental-states phps-mode-lex-analyzer--states)
+     (setq incremental-tokens phps-mode-lex-analyzer--tokens)
+     (setq incremental-imenu phps-mode-lex-analyzer--imenu)
+     (setq incremental-indent (phps-mode-test--hash-to-list 
phps-mode-lex-analyzer--lines-indent))
      (setq incremental-buffer (buffer-substring (point-min) (point-max)))
 
      ;; Setup incremental buffer
@@ -65,11 +65,11 @@
      (phps-mode-debug-message
        (message "\nTesting initial buffer '%s':\n'%s'\n" ,title 
incremental-buffer))
      (phps-mode)
-     (phps-mode-functions-process-current-buffer)
-     (setq initial-states phps-mode-lexer-states)
-     (setq initial-tokens phps-mode-lexer-tokens)
-     (setq initial-imenu phps-mode-functions-imenu)
-     (setq initial-indent (phps-mode-test-hash-to-list 
phps-mode-functions-lines-indent))
+     (phps-mode-lex-analyzer--process-current-buffer)
+     (setq initial-states phps-mode-lex-analyzer--states)
+     (setq initial-tokens phps-mode-lex-analyzer--tokens)
+     (setq initial-imenu phps-mode-lex-analyzer--imenu)
+     (setq initial-indent (phps-mode-test--hash-to-list 
phps-mode-lex-analyzer--lines-indent))
      (setq initial-buffer (buffer-substring (point-min) (point-max)))
 
      ;; Run tests
@@ -91,7 +91,7 @@
      (when ,title
        (message "\nPassed incremental tests for '%s'\n" ,title))))
 
-(defmacro phps-mode-test-with-buffer (source &optional title &rest body)
+(defmacro phps-mode-test--with-buffer (source &optional title &rest body)
   "Set up test buffer with SOURCE, TITLE and BODY."
   `(let ((test-buffer (generate-new-buffer "test")))
      (switch-to-buffer test-buffer)
@@ -105,7 +105,7 @@
      (when ,title
        (message "\nPassed tests for '%s'\n" ,title))))
 
-(defun phps-mode-test-hash-to-list (hash-table)
+(defun phps-mode-test--hash-to-list (hash-table)
   "Return a list that represent the HASH-TABLE.  Each element is a list: (list 
key value)."
   (let (result)
     (if (hash-table-p hash-table)
@@ -119,6 +119,7 @@
 
 (transient-mark-mode t)
 (electric-pair-mode t)
+(setq phps-mode-async-process nil)
 
 (provide 'phps-mode-test)
 
diff --git a/phps-mode-wy-macros.el b/phps-mode-wy-macros.el
index 980145d..09dc59d 100644
--- a/phps-mode-wy-macros.el
+++ b/phps-mode-wy-macros.el
@@ -26,15 +26,15 @@
 ;;; Code:
 
 
-(defvar phps-mode-wy-macros--CG
+(defvar phps-mode-wy-macros--CG-data
   (make-hash-table :test 'equal)
   "A hash-table with all settings.")
 
-(defun phps-mode-wy-macros-CG (subject &optional value)
+(defun phps-mode-wy-macros--CG (subject &optional value)
   "Return and optionally set VALUE of SUBJECT."
   (if value
-      (puthash subject value phps-mode-wy-macros--CG)
-    (gethash subject phps-mode-wy-macros--CG)))
+      (puthash subject value phps-mode-wy-macros--CG-data)
+    (gethash subject phps-mode-wy-macros--CG-data)))
 
 (defun zend_add_class_modifier (_class _modifier)
   "Add CLASS MODIFIER."
diff --git a/phps-mode.el b/phps-mode.el
index b7953f0..ee5dd10 100644
--- a/phps-mode.el
+++ b/phps-mode.el
@@ -1,12 +1,12 @@
 ;;; phps-mode.el --- Major mode for PHP with Semantic integration -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2018-2019  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2020  Free Software Foundation, Inc.
 
 ;; Author: Christian Johansson <address@hidden>
 ;; Maintainer: Christian Johansson <address@hidden>
 ;; Created: 3 Mar 2018
-;; Modified: 16 Jan 2019
-;; Version: 0.3.28
+;; Modified: 14 Feb 2020
+;; Version: 0.3.32
 ;; Keywords: tools, convenience
 ;; URL: https://github.com/cjohansson/emacs-phps-mode
 
@@ -50,19 +50,28 @@
 
 ;; NOTE use wisent-parse-toggle-verbose-flag and (semantic-debug) to debug 
parsing
 
-(require 'phps-mode-analyzer)
 (require 'phps-mode-flymake)
+(require 'phps-mode-lex-analyzer)
 (require 'phps-mode-semantic)
 (require 'phps-mode-syntax-table)
-(require 'phps-mode-tags)
+
 (require 'semantic)
 
+(defvar phps-mode-idle-interval 1
+  "Idle seconds before running the incremental lexer.")
+
 (defvar phps-mode-use-psr-2 t
   "Whether to use PSR-2 guidelines for white-space or not.")
 
 (defvar phps-mode-use-psr-12 t
   "Whether to use PSR-12 guidelines for white-space or not.")
 
+(defvar phps-mode-async-process t
+  "Whether to use asynchronous processes.")
+
+(defvar phps-mode-async-process-using-async-el nil
+  "Whether to use async.el for asynchronous processes.")
+
 (defvar phps-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "C-c C-r") #'phps-mode-rescan-buffer)
@@ -74,8 +83,8 @@
 (defun phps-mode-rescan-buffer ()
   "Re-scan buffer."
   (interactive)
-  (phps-mode-reset-local-variables)
-  (phps-mode-lexer-run))
+  (phps-mode-lex-analyzer--reset-local-variables)
+  (phps-mode-lex-analyzer--re2c-run))
 
 ;;;###autoload
 (defun phps-mode-flycheck-setup ()
@@ -117,14 +126,15 @@
           ;; All PHP files MUST end with a non-blank line, terminated with a 
single LF.
           (phps-mode-add-trailing-newline))
           
-        (phps-mode-analyzer-process-changes)
-        (phps-mode-functions-process-current-buffer)
+        (phps-mode-lex-analyzer--process-changes nil t)
+        (phps-mode-lex-analyzer--process-current-buffer)
         (indent-region (point-min) (point-max)))
     (let ((old-buffer-contents
            (buffer-substring-no-properties (point-min) (point-max)))
           (old-buffer (current-buffer))
           (temp-buffer (generate-new-buffer "*PHPs Formatting*"))
-          (new-buffer-contents ""))
+          (new-buffer-contents "")
+          (phps-mode-async-process nil))
       (save-excursion
         (switch-to-buffer temp-buffer)
         (insert old-buffer-contents)
@@ -153,17 +163,6 @@
         (delete-region (point-min) (point-max))
         (insert new-buffer-contents)))))
 
-(defun phps-mode-reset-local-variables ()
-  "Reset local variables."
-  (setq-local phps-mode-functions-allow-after-change t)
-  (setq-local phps-mode-analyzer-change-min nil)
-  (setq-local phps-mode-functions-idle-timer nil)
-  (setq-local phps-mode-functions-lines-indent nil)
-  (setq-local phps-mode-functions-imenu nil)
-  (setq-local phps-mode-functions-processed-buffer nil)
-  (setq-local phps-mode-lexer-tokens nil)
-  (setq-local phps-mode-lexer-states nil))
-
 (define-derived-mode phps-mode prog-mode "PHPs"
   "Major mode for PHP with Semantic integration."
 
@@ -180,10 +179,10 @@
 
   ;; Indentation
   ;; Indent-region will call this on each line of selected region
-  (setq-local indent-line-function #'phps-mode-functions-indent-line)
+  (setq-local indent-line-function #'phps-mode-lex-analyzer--indent-line)
 
   ;; Custom Imenu
-  (setq-local imenu-create-index-function 
#'phps-mode-functions-imenu-create-index)
+  (setq-local imenu-create-index-function 
#'phps-mode-lex-analyzer--imenu-create-index)
 
   ;; Should we follow PSR-2?
   (when phps-mode-use-psr-2
@@ -204,28 +203,28 @@
     ;; All PHP files MUST end with a non-blank line, terminated with a single 
LF.
     (setq require-final-newline t))
 
-  (phps-mode-reset-local-variables)
+  (phps-mode-lex-analyzer--reset-local-variables)
 
   ;; Make (comment-region) and (uncomment-region) work
-  (setq-local comment-region-function #'phps-mode-functions-comment-region)
-  (setq-local uncomment-region-function #'phps-mode-functions-uncomment-region)
+  (setq-local comment-region-function #'phps-mode-lex-analyzer--comment-region)
+  (setq-local uncomment-region-function 
#'phps-mode-lex-analyzer--uncomment-region)
   (setq-local comment-start "// ")
   (setq-local comment-end "")
 
   ;; Support for change detection
-  (add-hook 'after-change-functions #'phps-mode-functions-after-change 0 t)
+  (add-hook 'after-change-functions #'phps-mode-lex-analyzer--after-change 0 t)
 
   ;; Lexer
   (setq-local semantic-lex-syntax-table phps-mode-syntax-table)
 
   ;; Semantic
-  (setq-local semantic-lex-analyzer #'phps-mode-analyzer-lex)
+  (setq-local semantic-lex-analyzer 
#'phps-mode-lex-analyzer--cached-lex-analyzer)
 
   ;; Set semantic-lex initializer function
-  (add-hook 'semantic-lex-reset-functions #'phps-mode-lexer-setup 0 t)
+  (add-hook 'semantic-lex-reset-functions #'phps-mode-lex-analyzer--setup 0 t)
 
   ;; Initial run of lexer
-  (phps-mode-lexer-run)
+  (phps-mode-lex-analyzer--re2c-run)
 
   ;; Run semantic functions for new buffer
   (semantic-new-buffer-fcn)
@@ -234,10 +233,7 @@
   (when (boundp 'semantic-idle-scheduler-mode)
     (setq semantic-idle-scheduler-mode nil))
 
-  ;; Wisent LALR parser TODO
-  ;; (phps-mode-tags-init)
-
-  )
+)
 
 (provide 'phps-mode)
 ;;; phps-mode.el ends here
diff --git a/test/phps-mode-test-integration.el 
b/test/phps-mode-test-integration.el
index 62b7820..3fefba0 100644
--- a/test/phps-mode-test-integration.el
+++ b/test/phps-mode-test-integration.el
@@ -32,10 +32,10 @@
 (eval-when-compile
   (require 'phps-mode-macros))
 
-(defun phps-mode-test-integration-incremental-vs-initial-buffers ()
+(defun phps-mode-test-integration--incremental-vs-initial-buffers ()
   "Test for object-oriented PHP file."
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\nnamespace myNamespace\n{\n    class myClass\n    {\n        public 
function myFunction()\n        {\n            echo 'my statement';\n        }\n 
   }\n}\n"
    "Integration-test 1 for regular PHP with namespaces, classes and functions"
 
@@ -43,7 +43,7 @@
    (goto-char 145)
    (insert "\n\n        public function myFunctionB()\n        {\n            
echo 'my second statement';\n        }\n"))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\nnamespace myNamespace\n{\n    class myClass\n    {\n        public 
function myFunction()\n        {\n            echo 'my statement';\n        }\n 
   }\n}\n"
    "Integration-test 2 for regular PHP with namespaces, classes and functions"
 
@@ -57,7 +57,7 @@
    (goto-char 145)
    (execute-kbd-macro (kbd "<backspace>")))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    ""
    "Integration-test 3 for function-oriented PHP"
 
@@ -65,7 +65,7 @@
    (goto-char 1)
    (insert "<?php\nfunction myFunctionA()\n{\n    echo 'my second 
statement';\n}\n"))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\nnamespace myNamespace\n{\n    class myClass\n    {\n        public 
function myFunction()\n        {\n            echo 'my statement';\n        }\n 
   }\n}\n"
    "Integration-test 4 for regular PHP with namespaces, classes and functions, 
minor insert"
 
@@ -73,7 +73,7 @@
    (goto-char 132)
    (insert " is a complex one"))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\nnamespace myNamespace\n{\n    class myClass\n    {\n        public 
function myFunction()\n        {\n            echo 'my statement';\n        }\n 
   }\n}\n"
    "Integration-test 5 for regular PHP with namespaces, classes and functions, 
single deletion"
 
@@ -81,7 +81,7 @@
    (goto-char 132)
    (backward-delete-char-untabify 1))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\nnamespace myNamespace\n{\n    class myClass\n    {\n        public 
function myFunction()\n        {\n        echo 'my statement';\n        }\n    
}\n}\n"
    "Integration-test 6 for regular PHP with namespaces, classes and functions, 
single indent line"
 
@@ -89,7 +89,7 @@
    (goto-char 110)
    (insert "    "))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\nnamespace myNamespace\n{\n    class myClass\n    {\n        public 
function myFunction()\n        {\n        echo 'my statement';\n        }\n    
}\n}\n"
    "Integration-test 7 for regular PHP with namespaces, classes and functions, 
with multiple, isolated edits"
 
@@ -101,7 +101,7 @@
    (goto-char 28)
    (insert "One"))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\nif ($myCondition) {}\n"
    "Integration-test 8 for regular PHP with newline between curly brackets"
 
@@ -109,7 +109,7 @@
    (goto-char 26)
    (execute-kbd-macro (kbd "RET")))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\n/**\n * @see Something\n * @see here\n *\n */\n"
    "Integration-test 9 for regular PHP with newline in doc comment block"
 
@@ -117,7 +117,7 @@
    (goto-char 41)
    (execute-kbd-macro (kbd "RET")))
 
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    "<?php\necho 'my comment';\n"
    "Integration-test 10 insert code at end of buffer"
 
@@ -127,7 +127,7 @@
    (insert "\necho 'my comments';\n"))
 
   ;; TODO T_ENCAPSED_AND_WHITESPACE 72 should be removed by deletion (that is 
implicitly triggered by electric-pair-mode)
-  (phps-mode-test-incremental-vs-intial-buffer
+  (phps-mode-test--incremental-vs-intial-buffer
    ""
    "Integration-test 11 insert code in empty buffer using macro, use several 
passes"
 
@@ -138,13 +138,13 @@
    (execute-kbd-macro "echo 'was here';")
    (execute-kbd-macro (kbd "RET"))
    (execute-kbd-macro (kbd "RET"))
-   (phps-mode-analyzer-process-changes)
+   (phps-mode-lex-analyzer--process-changes)
 
    ;; Pass 2
    (execute-kbd-macro "if ($myCondition) {")
    (execute-kbd-macro (kbd "RET"))
    (execute-kbd-macro "echo 'my special condition';")
-   (phps-mode-analyzer-process-changes)
+   (phps-mode-lex-analyzer--process-changes)
 
    ;; Pass 3
    (execute-kbd-macro (kbd "TAB"))
@@ -153,23 +153,23 @@
   )
 
 ;; TODO Add tests for (delete-backward-char) as well
-(defun phps-mode-test-integration-whitespace-modifications ()
+(defun phps-mode-test-integration--whitespace-modifications ()
   "Test white-space modifications functions."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = 'abc';\n\n$var2 = '123';\n"
    "Add newline between two assignments and inspect moved tokens and states"
-   ;; (message "Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "States: %s" phps-mode-lexer-states)
+   ;; (message "Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "States: %s" phps-mode-lex-analyzer--states)
 
    ;; Initial state
 
    ;; Tokens
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_CONSTANT_ENCAPSED_STRING 14 . 19) (";" 19 . 20) (T_VARIABLE 22 . 27) ("=" 28 
. 29) (T_CONSTANT_ENCAPSED_STRING 30 . 35) (";" 35 . 36))))
 
    ;; States
-   (should (equal phps-mode-lexer-states
+   (should (equal phps-mode-lex-analyzer--states
                   '((35 36 1 nil) (30 35 1 nil) (28 29 1 nil) (22 27 1 nil) 
(19 20 1 nil) (14 19 1 nil) (12 13 1 nil) (7 11 1 nil) (1 7 1 nil))))
    
    ;; Insert newline
@@ -177,129 +177,129 @@
    (newline)
 
    ;; Final state
-   ;; (message "Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "States: %s" phps-mode-lexer-states)
-   (phps-mode-analyzer-process-changes)
-   ;; (message "Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "States: %s" phps-mode-lexer-states)
+   ;; (message "Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "States: %s" phps-mode-lex-analyzer--states)
+   (phps-mode-lex-analyzer--process-changes)
+   ;; (message "Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "States: %s" phps-mode-lex-analyzer--states)
 
    ;; Tokens
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_CONSTANT_ENCAPSED_STRING 14 . 19) (";" 19 . 20) (T_VARIABLE 23 . 28) ("=" 29 
. 30) (T_CONSTANT_ENCAPSED_STRING 31 . 36) (";" 36 . 37))))
 
    ;; States
-   (should (equal phps-mode-lexer-states
+   (should (equal phps-mode-lex-analyzer--states
                   '((36 37 1 nil) (31 36 1 nil) (29 30 1 nil) (23 28 1 nil) 
(19 20 1 nil) (14 19 1 nil) (12 13 1 nil) (7 11 1 nil) (1 7 1 nil)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = 'abc';\n\n$var2 = '123';\n"
    "Delete backward char between two assignments and inspect moved tokens and 
states"
-   ;; (message "Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "States: %s" phps-mode-lexer-states)
+   ;; (message "Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "States: %s" phps-mode-lex-analyzer--states)
 
    ;; Initial state
 
    ;; Tokens
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_CONSTANT_ENCAPSED_STRING 14 . 19) (";" 19 . 20) (T_VARIABLE 22 . 27) ("=" 28 
. 29) (T_CONSTANT_ENCAPSED_STRING 30 . 35) (";" 35 . 36))))
 
    ;; States
-   (should (equal phps-mode-lexer-states
+   (should (equal phps-mode-lex-analyzer--states
                   '((35 36 1 nil) (30 35 1 nil) (28 29 1 nil) (22 27 1 nil) 
(19 20 1 nil) (14 19 1 nil) (12 13 1 nil) (7 11 1 nil) (1 7 1 nil))))
 
    ;; Insert newline
    (goto-char 21)
    (delete-char 1)
 
-   (phps-mode-analyzer-process-changes)
+   (phps-mode-lex-analyzer--process-changes)
 
    ;; Final state
    ;; (message "Modified buffer: '%s'" (buffer-substring-no-properties 
(point-min) (point-max)))
-   ;; (message "Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "States: %s" phps-mode-lexer-states)
+   ;; (message "Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "States: %s" phps-mode-lex-analyzer--states)
 
    ;; Tokens
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_CONSTANT_ENCAPSED_STRING 14 . 19) (";" 19 . 20) (T_VARIABLE 21 . 26) ("=" 27 
. 28) (T_CONSTANT_ENCAPSED_STRING 29 . 34) (";" 34 . 35))))
 
    ;; States
-   (should (equal phps-mode-lexer-states
+   (should (equal phps-mode-lex-analyzer--states
                   '((34 35 1 nil) (29 34 1 nil) (27 28 1 nil) (21 26 1 nil) 
(19 20 1 nil) (14 19 1 nil) (12 13 1 nil) (7 11 1 nil) (1 7 1 nil)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true):\n    $var = 'abc';\n    $var2 = '123';\nendif;\n"
    "Add newline inside if body after two assignments and inspect moved tokens 
and states"
 
    ;; Initial state
-   ;; (message "Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "States: %s" phps-mode-lexer-states)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "States: %s" phps-mode-lex-analyzer--states)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_STRING 11 
. 15) (")" 15 . 16) (":" 16 . 17) (T_VARIABLE 22 . 26) ("=" 27 . 28) 
(T_CONSTANT_ENCAPSED_STRING 29 . 34) (";" 34 . 35) (T_VARIABLE 40 . 45) ("=" 46 
. 47) (T_CONSTANT_ENCAPSED_STRING 48 . 53) (";" 53 . 54) (T_ENDIF 55 . 60) (";" 
60 . 61))))
 
-   (should (equal phps-mode-lexer-states
+   (should (equal phps-mode-lex-analyzer--states
                   '((60 61 1 nil) (55 60 1 nil) (53 54 1 nil) (48 53 1 nil) 
(46 47 1 nil) (40 45 1 nil) (34 35 1 nil) (29 34 1 nil) (27 28 1 nil) (22 26 1 
nil) (16 17 1 nil) (15 16 1 nil) (11 15 1 nil) (10 11 1 nil) (7 9 1 nil) (1 7 1 
nil))))
 
    ;; Insert newline and then indent
    (goto-char 54)
    (newline-and-indent)
 
-   (phps-mode-analyzer-process-changes)
+   (phps-mode-lex-analyzer--process-changes)
 
    ;; Final state
-   ;; (message "Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "States: %s" phps-mode-lexer-states)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "States: %s" phps-mode-lex-analyzer--states)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_STRING 11 
. 15) (")" 15 . 16) (":" 16 . 17) (T_VARIABLE 22 . 26) ("=" 27 . 28) 
(T_CONSTANT_ENCAPSED_STRING 29 . 34) (";" 34 . 35) (T_VARIABLE 40 . 45) ("=" 46 
. 47) (T_CONSTANT_ENCAPSED_STRING 48 . 53) (";" 53 . 54) (T_ENDIF 60 . 65) (";" 
65 . 66))))
 
-   (should (equal phps-mode-lexer-states
+   (should (equal phps-mode-lex-analyzer--states
                   '((65 66 1 nil) (60 65 1 nil) (53 54 1 nil) (48 53 1 nil) 
(46 47 1 nil) (40 45 1 nil) (34 35 1 nil) (29 34 1 nil) (27 28 1 nil) (22 26 1 
nil) (16 17 1 nil) (15 16 1 nil) (11 15 1 nil) (10 11 1 nil) (7 9 1 nil) (1 7 1 
nil)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true):\n    $var = \"abc\nanother line here\nmore text 
here\";\n    $var2 = '123';\nendif;"
    "Add test for inserting newlines inside token"
 
-   ;; (message "Before Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "Before States: %s" phps-mode-lexer-states)
+   ;; (message "Before Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "Before States: %s" phps-mode-lex-analyzer--states)
 
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_STRING 11 
. 15) (")" 15 . 16) (":" 16 . 17) (T_VARIABLE 22 . 26) ("=" 27 . 28) 
(T_CONSTANT_ENCAPSED_STRING 29 . 67) (";" 67 . 68) (T_VARIABLE 73 . 78) ("=" 79 
. 80) (T_CONSTANT_ENCAPSED_STRING 81 . 86) (";" 86 . 87) (T_ENDIF 88 . 93) (";" 
93 . 94))))
-   (should (equal phps-mode-lexer-states
+   (should (equal phps-mode-lex-analyzer--states
                   '((93 94 1 nil) (88 93 1 nil) (86 87 1 nil) (81 86 1 nil) 
(79 80 1 nil) (73 78 1 nil) (67 68 1 nil) (29 67 1 nil) (27 28 1 nil) (22 26 1 
nil) (16 17 1 nil) (15 16 1 nil) (11 15 1 nil) (10 11 1 nil) (7 9 1 nil) (1 7 1 
nil))))
 
    ;; Insert newline and then indent
    (goto-char 51)
    (newline-and-indent)
 
-   (phps-mode-analyzer-process-changes)
+   (phps-mode-lex-analyzer--process-changes)
 
-   ;; (message "After Tokens %s" phps-mode-lexer-tokens)
-   ;; (message "After States: %s" phps-mode-lexer-states)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "After Tokens %s" phps-mode-lex-analyzer--tokens)
+   ;; (message "After States: %s" phps-mode-lex-analyzer--states)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_STRING 11 
. 15) (")" 15 . 16) (":" 16 . 17) (T_VARIABLE 22 . 26) ("=" 27 . 28) 
(T_CONSTANT_ENCAPSED_STRING 29 . 76) (";" 76 . 77) (T_VARIABLE 82 . 87) ("=" 88 
. 89) (T_CONSTANT_ENCAPSED_STRING 90 . 95) (";" 95 . 96) (T_ENDIF 97 . 102) 
(";" 102 . 103))))
-   (should (equal phps-mode-lexer-states
+   (should (equal phps-mode-lex-analyzer--states
                   '((102 103 1 nil) (97 102 1 nil) (95 96 1 nil) (90 95 1 nil) 
(88 89 1 nil) (82 87 1 nil) (76 77 1 nil) (29 76 1 nil) (27 28 1 nil) (22 26 1 
nil) (16 17 1 nil) (15 16 1 nil) (11 15 1 nil) (10 11 1 nil) (7 9 1 nil) (1 7 1 
nil)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n"
    "White-space changes in imenu function-oriented file"
 
-   (should (equal (phps-mode-functions-get-imenu) '(("myFunctionA" . 16) 
("myFunctionB" . 42))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myFunctionA" . 16) 
("myFunctionB" . 42))))
 
    (goto-char 32)
    (newline-and-indent)
 
-   (phps-mode-analyzer-process-changes)
+   (phps-mode-lex-analyzer--process-changes)
 
-   (should (equal (phps-mode-functions-get-imenu) '(("myFunctionA" . 16) 
("myFunctionB" . 43)))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myFunctionA" . 16) 
("myFunctionB" . 43)))))
 
   )
 
 (defun phps-mode-test-integration ()
   "Run test for integration."
   (setq debug-on-error t)
-  ;; (setq phps-mode-analyzer-process-on-indent-and-imenu t)
-  (phps-mode-test-integration-incremental-vs-initial-buffers)
-  ;; (phps-mode-test-integration-whitespace-modifications)
+  ;; (setq phps-mode-analyzer--process-on-indent-and-imenu t)
+  (phps-mode-test-integration--incremental-vs-initial-buffers)
+  ;; (phps-mode-test-integration--whitespace-modifications)
   )
 
 (phps-mode-test-integration)
diff --git a/test/phps-mode-test-functions.el 
b/test/phps-mode-test-lex-analyzer.el
similarity index 71%
rename from test/phps-mode-test-functions.el
rename to test/phps-mode-test-lex-analyzer.el
index 31aef62..5e9b46f 100644
--- a/test/phps-mode-test-functions.el
+++ b/test/phps-mode-test-lex-analyzer.el
@@ -1,4 +1,4 @@
-;;; phps-mode-test-functions.el --- Tests for functions -*- lexical-binding: t 
-*-
+;;; phps-mode-test-lex-analyzer.el --- Tests for functions -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2018-2019  Free Software Foundation, Inc.
 
@@ -29,225 +29,225 @@
 (require 'phps-mode)
 (require 'phps-mode-test)
 
-(defun phps-mode-test-functions-process-changes ()
-  "Test `phps-mode-analyzer-process-changes'."
+(defun phps-mode-test-lex-analyzer-process-changes ()
+  "Test `phps-mode-lex-analyzer--process-changes'."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "\n<html>\n<?php\n/**\n * Bla\n */"
    "Process changes before current tokens"
    (goto-char (point-min))
    (insert "<?php echo 'test';\n?>")
    (should (equal
-            (phps-mode-analyzer-process-changes)
+            (phps-mode-lex-analyzer--process-changes)
             '((RUN-FULL-LEXER) (FOUND-NO-HEAD-TOKENS 1)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "\n<html>\n<?php\n/**\n * Bla\n */"
    "Process changes without changes"
    (should (equal
-            (phps-mode-analyzer-process-changes)
+            (phps-mode-lex-analyzer--process-changes)
             '((RUN-FULL-LEXER) (FOUND-NO-CHANGE-POINT-MINIMUM)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "\n<html>\n<?php\n/**\n * Bla\n */"
    "Process changes after existing tokens"
    (goto-char (point-max))
    (insert "\necho 'I was here';\n")
    (should (equal
-            (phps-mode-analyzer-process-changes)
+            (phps-mode-lex-analyzer--process-changes)
             '((INCREMENTAL-LEX 15)))))
 
    )
 
-(defun phps-mode-test-functions-alternative-indentation ()
-  "Test `phps-mode-analyzer--alternative-indentation'."
+(defun phps-mode-test-lex-analyzer-alternative-indentation ()
+  "Test `phps-mode-lex-analyzer--alternative-indentation'."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif ($myCondition) {\necho 'I was here';\n}"
    "Alternative indentation inside if block" 
    (goto-char 32)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (goto-char 15)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (goto-char (point-max))
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "<?php\nif ($myCondition) {\n    echo 'I was here';\n}"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif ($myCondition) {\necho 'I was here';\necho 'I was here 
again';\n}"
    "Alternative indentation on closing if block" 
    (goto-char 30)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (goto-char 57)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (goto-char (point-max))
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "<?php\nif ($myCondition) {\n    echo 'I was here';\n    echo 'I 
was here again';\n}"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif ($test) {\n    if ($test2) {\n\n}\n}"
    "Alternative indentation on nested if block with empty contents" 
    (goto-char 40)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (goto-char (point-max))
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "<?php\nif ($test) {\n    if ($test2) {\n\n    }\n}"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif ($test) {\n    if ($test2) {\n        \n    }\n\n}"
    "Alternative indentation on multiple closing brackets"
    (goto-char 53)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "<?php\nif ($test) {\n    if ($test2) {\n        \n    }\n    
\n}"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif ($test) {\n    \n} else if ($test) {\n    \n}\n"
    "Alternative indentation on elseif block"
    (goto-char 25)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "<?php\nif ($test) {\n    \n} else if ($test) {\n    \n}\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "if ($true) {\n    if ($true) {\n    }\n}"
    "Alternative indentation on closing bracket inside parent bracket"
    (goto-char 36)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "if ($true) {\n    if ($true) {\n    }\n}"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "/**\n *\n */"
    "Alternative indentation on last line of doc comment block"
    (goto-char 11)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             1))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "/**\n *\n */"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "/**\n *\n */\n"
    "Alternative indentation on line after closing of doc comment block"
    (goto-char 12)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "/**\n *\n */\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "$var = 'abc';\n// Comment"
    "Alternative indentation on single-line assignment"
    (goto-char 1)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "$var = 'abc';\n// Comment"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "$var = 'abc';\n// Comment"
    "Alternative indentation on line after single-line assignment"
    (goto-char 15)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "$var = 'abc';\n// Comment"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "$var =\n    'abc';\n$var =\n    'abc'\n    . 'def';\n// Comment\n"
    "Alternative indentation on first line of multi-line assignment"
    (goto-char 1)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "$var =\n    'abc';\n$var =\n    'abc'\n    . 'def';\n// 
Comment\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "$var =\n    'abc';\n$var =\n    'abc'\n    . 'def';\n// Comment\n"
    "Alternative indentation on second line of multi-line assignment"
    (goto-char 30)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "$var =\n    'abc';\n$var =\n    'abc'\n    . 'def';\n// 
Comment\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "$var =\n    'abc';\n$var =\n    'abc'\n    . 'def';\n// Comment\n"
    "Alternative indentation on last line of multi-line assignment"
    (goto-char 12)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (goto-char 40)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             4))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
               buffer-contents
               "$var =\n    'abc';\n$var =\n    'abc'\n    . 'def';\n// 
Comment\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "$var =\n    'abc';\n$var =\n    'abc'\n    . 'def';\n// Comment\n"
    "Alternative indentation on line after multi-line assignment"
    (goto-char 53)
    (should (equal
-            (phps-mode-analyzer--alternative-indentation)
+            (phps-mode-lex-analyzer--alternative-indentation)
             0))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal
@@ -256,844 +256,844 @@
 
   )
 
-(defun phps-mode-test-functions-move-lines-indent ()
+(defun phps-mode-test-lex-analyzer-move-lines-indent ()
   "Test `phps-mode-functions-move-lines-indent'."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n * Bla\n */"
    "Move line-indents zero lines down"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-moved-lines-indent 
(phps-mode-functions-get-lines-indent) 2 0)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-moved-lines-indent 
(phps-mode-lex-analyzer--get-lines-indent) 2 0)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n * Bla\n */"
    "Move line-indents one line down"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 1)) (5 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-moved-lines-indent 
(phps-mode-functions-get-lines-indent) 2 1)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 1)) (5 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-moved-lines-indent 
(phps-mode-lex-analyzer--get-lines-indent) 2 1)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n * Bla\n */"
    "Move line-indents two lines down"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 1)) (6 (0 
1))) (phps-mode-test-hash-to-list (phps-mode-functions-get-moved-lines-indent 
(phps-mode-functions-get-lines-indent) 2 2)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 1)) (6 (0 
1))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-moved-lines-indent 
(phps-mode-lex-analyzer--get-lines-indent) 2 2)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n * Bla\n */"
    "Move line-indents one line up"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))
-   (should (equal '((1 (0 0)) (2 (0 1)) (3 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-moved-lines-indent 
(phps-mode-functions-get-lines-indent) 3 -1)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent))))
+   (should (equal '((1 (0 0)) (2 (0 1)) (3 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-moved-lines-indent 
(phps-mode-lex-analyzer--get-lines-indent) 3 -1)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n * Bla\n */"
    "Move line-indents two lines up"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))
-   (should (equal '((1 (0 1)) (2 (0 1))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-moved-lines-indent 
(phps-mode-functions-get-lines-indent) 3 -2)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent))))
+   (should (equal '((1 (0 1)) (2 (0 1))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-moved-lines-indent 
(phps-mode-lex-analyzer--get-lines-indent) 3 -2)))))
 
   )
 
-(defun phps-mode-test-functions-get-lines-indent ()
-  "Test `phps-mode-functions-get-lines-indent' function."
+(defun phps-mode-test-lex-analyzer-get-lines-indent ()
+  "Test `phps-mode-lex-analyzer--get-lines-indent' function."
   
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n * Bla\n */"
    "DOC-COMMENT"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nmyFunction(array(\n    23,\n    [\n        25\n    ]\n    )\n);"
    "Round and square bracket expressions"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (2 0)) (6 (1 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (2 0)) (6 (1 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nvar_dump(array(<<<EOD\nfoobar!\nEOD\n));\n?>"
    "HEREDOC in arguments example"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$str = <<<'EOD'\nExample of string\nspanning multiple lines\nusing 
nowdoc syntax.\nEOD;\n"
    "Multi-line NOWDOC string"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = \"A line\nmore text here\nlast line here\";"
    "Multi-line double-quoted string"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = 'A line\nmore text here\nlast line here';"
    "Multi-line single-quoted string"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho \"A line\" .\n    \"more text here\" .\n    \"last line 
here\";"
    "Concatenated double-quoted-string spanning multiple-lines"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho myFunction(\"A line\" .\n    \"more text here\" .\n    \"last 
line here\");"
    "Concatenated double-quoted-string spanning multiple-lines inside function"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho \"A line\"\n    . \"more text here\"\n    . \"last line 
here\";"
    "Concatenated double-quoted-string spanning multiple-lines 2"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho myFunction(\"A line\" .\n    \"more text here\" .\n    \"last 
line here\");"
    "Concatenated double-quoted-string spanning multiple-lines inside function 
2"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho 'A line' .\n    'more text here' .\n    'last line here';"
    "Concatenated single-quoted-string spanning multiple-lines"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho myFunction('A line' .\n    'more text here' .\n    'last line 
here');"
    "Concatenated single-quoted-string spanning multiple-lines inside function"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho 'A line'\n    . 'more text here'\n    . 'last line here';"
    "Concatenated single-quoted-string spanning multiple-lines 2"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho myFunction('A line'\n    . 'more text here'\n    . 'last line 
here');"
    "Concatenated single-quoted-string spanning multiple-lines inside function 
2"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho <<<EOD\nExample of string\nspanning multiple lines\nusing 
heredoc syntax.\nEOD;\n"
    "Multi-line HEREDOC string outside assignment"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n * @var string\n */\necho 'was here';\n"
    "Statement after doc-comment"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1)) (5 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1)) (5 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/** @define _SYSTEM_START_TIME_     Startup time for system 
*/\ndefine('_SYSTEM_START_TIME_', microtime(true));\necho 'statement';\n"
    "Statement after a define() with a doc-comment"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nfunction myFunction($parameters = null)\n{\n    echo 
'statement';\n}\n"
    "Statement after one-lined function declaration with optional argument"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php if (true) { ?>\n    <?php echo 'here'; ?>\n<?php } ?>"
    "Regular if-expression but inside scripting tags"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (1 0)) (3 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (1 0)) (3 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\ndo {\n    echo 'true';\n} while ($number > 0\n    && $letter > 
0\n);"
    "Do while loop with multi-line condition"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\ndo {\n    echo 'true';\n} while ($number > 0\n    && $letter > 
0\n);"
    "Do while loop with multi-line condition"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$myVar = 'blaha'\n    . 'ijeije' . __(\n        'okeoke'\n    ) . 
'okeoke';\n?>"
    "Concatenated assignment string with function call"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$myVar = 'blaha'\n    . 'ijeije' . __(\n        'okeoke'\n    )\n   
 . 'okeoke';\n?>"
    "Concatenated assignment string with function call"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho 'blaha'\n    . 'ijeije' . __(\n        'okeoke'\n    ) . 
'okeoke';\n?>"
    "Concatenated echo string with function call"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho 'blaha'\n    . 'ijeije' . __(\n        'okeoke'\n    )\n    . 
'okeoke';\n?>"
    "Concatenated echo string with function call"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$options = [\n    0 => [\n        'label' => __('No'),\n        
'value' => 0,\n    ],\n];"
    "Assignment with square bracketed array"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$options = array(\n    'blaha' .\n        'blaha',\n    123,\n    
'blaha'\n);"
    "Assignment with square bracketed array"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nreturn $variable\n    && $variable;"
    "Multi-line return statement"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$options = myFunction(\n    array(array(\n        'options' => 
123\n    ))\n);"
    "Assignment with double-dimensional array with double arrow assignment 
inside function call"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nswitch ($condition) {\n    case 34:\n        if ($item['Random'] % 
10 == 0) {\n            $attributes['item'] = ($item['IntegerValue'] / 10);\n   
     } else {\n            $attributes['item'] =\n                
number_format(($item['IntegerValue'] / 10), 1, '.', '');\n        }\n        
break;\n}\n"
    "Switch case with conditional modulo expression"
-   ;; (message "indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (3 0)) (6 (2 
0)) (7 (3 0)) (8 (4 0)) (9 (2 0)) (10 (2 0)) (11 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   ;; (message "indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (3 0)) (6 (2 
0)) (7 (3 0)) (8 (4 0)) (9 (2 0)) (10 (2 0)) (11 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$options = array(\n    'options' => array(array(\n        
'errorTo'\n    ))\n);"
    "Assignment with three-dimensional array with double arrow assignment"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif ($myCondition) {\n    $myObject->myMethod(myClass::class)\n      
  ->myMethod2($myArgument2);\n    }"
    "Object-oriented file with bracket-less namespace with multiple levels, 
class that extends and implements and functions with optional arguments"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$myObj->myFunction()\n    ->mySecondaryFunction();"
    "Indentation of chained class method calls outside of assignments and 
conditionals"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n\n$myVar = $myClass->meMethod()\n    ->mySecondMethod()\n    
->myThirdMethod()\n->myFourthFunction(\n    $myVariable\n);"
    "Indentation for chained object operators in assignment with method call 
with arguments"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0)) (6 (1 
0)) (7 (2 0)) (8 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0)) (6 (1 
0)) (7 (2 0)) (8 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n\n$myResult = !empty($myVar->myMethod3)\n    && $myVar->myMethod\n  
      && $myVar->myMethod2;\n"
    "Indentation for chained object operators in assignment"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$array = [\n    'second' => [\n        'hello' => true\n        
]\n];\n\n$array = array(\n    'second' => array(\n        'third' => true\n     
   )\n);"
    "Indent multi-dimensional arrays without trailing commas"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (1 0)) (10 (2 0)) (11 (1 0)) (12 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (1 0)) (10 (2 0)) (11 (1 0)) (12 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent))))
 
-   (phps-mode-test-with-buffer
+   (phps-mode-test--with-buffer
     "<html>\n    <head>\n        <?php echo $title; ?>\n    </head>\n    
<body>\n    <?php\n\n    if ($myTest) {\n        doSomething();\n    }\n\n    
?>\n    </body>\n</html>"
     "A mixed HTML and PHP file."
-    ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-    (should (equal '((1 (0 0)) (2 (1 0)) (3 (2 0)) (4 (1 0)) (5 (1 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (1 0)) (10 (0 0)) (11 (0 0)) (12 (0 0)) (13 (1 0)) 
(14 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+    ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+    (should (equal '((1 (0 0)) (2 (1 0)) (3 (2 0)) (4 (1 0)) (5 (1 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (1 0)) (10 (0 0)) (11 (0 0)) (12 (0 0)) (13 (1 0)) 
(14 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
    )
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n\n    if ($fullInfo) $fullInfo = unserialize ($fullInfo);\n    else 
array();\n\n"
    "Indentation for single-line inline control structures."
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php
\n\nif (true) {\n    // Was here\n}"
    "If condition after a mixed newline encoded file"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
   )
 
-(defun phps-mode-test-functions-get-lines-indent-psr-2 ()
+(defun phps-mode-test-lex-analyzer-get-lines-indent-psr-2 ()
   "Test PSR-2 examples from: https://www.php-fig.org/psr/psr-2/.";
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nuse FooInterface;\nuse BarClass as 
Bar;\nuse OtherVendor\\OtherPackage\\BazClass;\n\nclass Foo extends Bar 
implements FooInterface\n{\n    public function sampleMethod($a, $b = null)\n   
 {\n        if ($a === $b) {\n            bar();\n        } elseif ($a > $b) 
{\n            $foo->bar($arg1);\n        } else {\n            
BazClass::bar($arg2, $arg3);\n        }\n    }\n\n    final public static 
function bar()\n    {\n        // method body\n   [...]
    "PSR-2 : 1.1. Example"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (0 0)) (10 (1 0)) (11 (1 0)) (12 (2 0)) (13 (3 0)) 
(14 (2 0)) (15 (3 0)) (16 (2 0)) (17 (3 0)) (18 (2 0)) (19 (1 0)) (20 (1 0)) 
(21 (1 0)) (22 (1 0)) (23 (2 0)) (24 (1 0)) (25 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (0 0)) (10 (1 0)) (11 (1 0)) (12 (2 0)) (13 (3 0)) 
(14 (2 0)) (15 (3 0)) (16 (2 0)) (17 (3 0)) (18 (2 0)) (19 (1 0)) (20 (1 0)) 
(21 (1 0)) (22 (1 0)) (23 (2 0)) (24 (1 0)) (25 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nuse FooClass;\nuse BarClass as 
Bar;\nuse OtherVendor\\OtherPackage\\BazClass;\n\n// ... additional PHP code 
..."
    "PSR-2 : 3. Namespace and Use Declarations"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nuse FooClass;\nuse BarClass as 
Bar;\nuse OtherVendor\\OtherPackage\\BazClass;\n\nclass ClassName extends 
ParentClass implements \\ArrayAccess, \\Countable\n{\n    // constants, 
properties, methods\n}"
    "PSR-2 : 4.1. Extends and Implements : Example 1"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (0 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (0 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nuse FooClass;\nuse BarClass as 
Bar;\nuse OtherVendor\\OtherPackage\\BazClass;\n\nclass ClassName extends 
ParentClass implements\n    \\ArrayAccess,\n    \\Countable,\n    
\\Serializable\n{\n    // constants, properties, methods\n}"
    "PSR-2 : 4.1. Extends and Implements : Example 2"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (1 0)) (10 (1 0)) (11 (1 0)) (12 (0 0)) (13 (1 0)) 
(14 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (0 0)) (8 (0 0)) (9 (1 0)) (10 (1 0)) (11 (1 0)) (12 (0 0)) (13 (1 0)) 
(14 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nclass ClassName\n{\n    public $foo = 
null;\n}"
    "PSR-2 : 4.2. Properties"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nclass ClassName\n{\n    public 
function fooBarBaz($arg1, &$arg2, $arg3 = [])\n    {\n        // method body\n  
  }\n}"
    "PSR-2 : 4.3. Methods"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (1 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (1 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nclass ClassName\n{\n    public 
function foo($arg1, &$arg2, $arg3 = [])\n    {\n        // method body\n    
}\n}"
    "PSR-2 : 4.4. Method Arguments : Example 1"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (1 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (1 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nclass ClassName\n{\n    public 
function aVeryLongMethodName(\n        ClassTypeHint $arg1,\n        &$arg2,\n  
      array $arg3 = []\n    ) {\n        // method body\n    }\n}"
    "PSR-2 : 4.4. Method Arguments : Example 2"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (2 0)) (8 (2 0)) (9 (2 0)) (10 (1 0)) (11 (2 0)) (12 (1 0)) (13 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (2 0)) (8 (2 0)) (9 (2 0)) (10 (1 0)) (11 (2 0)) (12 (1 0)) (13 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace Vendor\\Package;\n\nabstract class ClassName\n{\n    
protected static $foo;\n\n    abstract protected function zim();\n\n    final 
public static function bar()\n    {\n        // method body\n    }\n}"
    "PSR-2 ; 4.5. abstract, final, and static"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (1 0)) (8 (1 0)) (9 (1 0)) (10 (1 0)) (11 (1 0)) (12 (2 0)) (13 (1 0)) 
(14 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 
0)) (7 (1 0)) (8 (1 0)) (9 (1 0)) (10 (1 0)) (11 (1 0)) (12 (2 0)) (13 (1 0)) 
(14 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nbar();\n$foo->bar($arg1);\nFoo::bar($arg2, $arg3);"
    "PSR-2 : 4.6. Method and Function Calls : Example 1"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$foo->bar(\n    $longArgument,\n    $longerArgument,\n    
$muchLongerArgument\n);"
    "PSR-2 : 4.6. Method and Function Calls : Example 2"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif ($expr1) {\n    // if body\n} elseif ($expr2) {\n    // elseif 
body\n} else {\n    // else body;\n}"
    "PSR-2 : 5.1. if, elseif, else"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nswitch ($expr) {\n    case 0:\n        echo 'First case, with a 
break';\n        break;\n    case 1:\n        echo 'Second case, which falls 
through';\n        // no break\n    case 2:\n    case 3:\n    case 4:\n        
echo 'Third case, return instead of break';\n        return;\n    default:\n    
    echo 'Default case';\n        break;\n}"
    "PSR-2 : 5.2. switch, case"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 
0)) (7 (2 0)) (8 (2 0)) (9 (1 0)) (10 (1 0)) (11 (1 0)) (12 (2 0)) (13 (2 0)) 
(14 (1 0)) (15 (2 0)) (16 (2 0)) (17 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 
0)) (7 (2 0)) (8 (2 0)) (9 (1 0)) (10 (1 0)) (11 (1 0)) (12 (2 0)) (13 (2 0)) 
(14 (1 0)) (15 (2 0)) (16 (2 0)) (17 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nwhile ($expr) {\n    // structure body\n}"
    "PSR-2 : 5.3. while, do while : Example 1"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\ndo {\n    // structure body;\n} while ($expr);"
    "PSR-2 : 5.3. while, do while : Example 2"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nfor ($i = 0; $i < 10; $i++) {\n    // for body\n}"
    "PSR-2 : 5.4. for"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
   
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nforeach ($iterable as $key => $value) {\n    // foreach body\n}"
    "PSR-2 : 5.5. foreach"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\ntry {\n    // try body\n} catch (FirstExceptionType $e) {\n    // 
catch body\n} catch (OtherExceptionType $e) {\n    // catch body\n}"
    "PSR-2 : 5.6. try, catch"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$closureWithArgs = function ($arg1, $arg2) {\n    // 
body\n};\n\n$closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, 
$var2) {\n    // body\n};"
    "PSR-2 : 6. Closures : Example 1"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$longArgs_noVars = function (\n    $longArgument,\n    
$longerArgument,\n    $muchLongerArgument\n) {\n    // 
body\n};\n\n$noArgs_longVars = function () use (\n    $longVar1,\n    
$longerVar2,\n    $muchLongerVar3\n) {\n    // body\n};\n\n$longArgs_longVars = 
function (\n    $longArgument,\n    $longerArgument,\n    
$muchLongerArgument\n) use (\n    $longVar1,\n    $longerVar2,\n    
$muchLongerVar3\n) {\n    // body\n};\n\n$longArgs_shortVars = function (\n    
$longArgument,\n [...]
    "PSR-2 : 6. Closures : Example 2"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0)) (9 (0 0)) (10 (0 0)) (11 (1 0)) (12 (1 0)) (13 (1 0)) 
(14 (0 0)) (15 (1 0)) (16 (0 0)) (17 (0 0)) (18 (0 0)) (19 (1 0)) (20 (1 0)) 
(21 (1 0)) (22 (0 0)) (23 (1 0)) (24 (1 0)) (25 (1 0)) (26 (0 0)) (27 (1 0)) 
(28 (0 0)) (29 (0 0)) (30 (0 0)) (31 (1 0)) (32 (1 0)) (33 (1 0)) (34 (0 0)) 
(35 (1 0)) (36 (0 0)) (37 (0 0)) (38 (0 0)) (39 (1 0)) (40 (1 0)) (41 (1 0)) 
(42 (0 0)) (43 (1 0)) (44 (0 0 [...]
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0)) (9 (0 0)) (10 (0 0)) (11 (1 0)) (12 (1 0)) (13 (1 0)) 
(14 (0 0)) (15 (1 0)) (16 (0 0)) (17 (0 0)) (18 (0 0)) (19 (1 0)) (20 (1 0)) 
(21 (1 0)) (22 (0 0)) (23 (1 0)) (24 (1 0)) (25 (1 0)) (26 (0 0)) (27 (1 0)) 
(28 (0 0)) (29 (0 0)) (30 (0 0)) (31 (1 0)) (32 (1 0)) (33 (1 0)) (34 (0 0)) 
(35 (1 0)) (36 (0 0)) (37 (0 0)) (38 (0 0)) (39 (1 0)) (40 (1 0)) (41 (1 0)) 
(42 (0 0)) (43 (1 0)) (44 (0 0 [...]
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$foo->bar(\n    $arg1,\n    function ($arg2) use ($var1) {\n        
// body\n    },\n    $arg3\n);"
    "PSR-2 : 6. Closures : Example 3"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (2 0)) (6 (1 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (2 0)) (6 (1 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
   )
 
-(defun phps-mode-test-functions-get-lines-indent-multi-line-assignments ()
+(defun phps-mode-test-lex-analyzer-get-lines-indent-multi-line-assignments ()
   "Test for multi-line assignments."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$variable = array(\n    'random4'\n);\n$variable = true;\n"
    "Array assignment on three lines"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$variable = array(\n    'random4' =>\n        'hello'\n);"
    "Array assignment with double arrow elements on four lines"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$variable = array(\n    'random4');\n$variable = true;\n"
    "Array assignment on two lines"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) ) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) ) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = 'A line' .\n    'more text here' .\n    'last line here';"
    "Concatenated single-quoted-string multiple-lines in assignment"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var .=\n    'A line';"
    "Concatenated equal single-quoted-string on multiple-lines in assignment"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var *=\n    25;"
    "Multiplication equal assignment on multiple-lines"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$str = <<<EOD\nExample of string\nspanning multiple lines\nusing 
heredoc syntax.\nEOD;\n"
    "Multi-line HEREDOC string in assignment"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var =\n    500 .\n    \"200\" .\n    100.0 .\n    '200' .\n    
$this->getTail()\n    ->getBottom();"
    "Multi-line assignments"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (2 
0)) (7 (2 0)) (8 (3 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (2 
0)) (7 (2 0)) (8 (3 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
   )
 
-(defun phps-mode-test-functions-get-lines-indent-inline-if ()
+(defun phps-mode-test-lex-analyzer-get-lines-indent-inline-if ()
   "Test for inline if indentations."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true)\n    echo 'Something';\nelse\n    echo 'Something 
else';\necho true;\n"
    "Inline control structures if else"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true)\n    echo 'Something';\nelse if (true)\n    echo 
'Something else';\necho true;\n"
    "Inline control structures if else if"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nwhile (true)\n    echo 'Something';"
    "Inline control structures while"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
   )
 
-(defun phps-mode-test-functions-get-lines-indent-alternative-if ()
+(defun phps-mode-test-lex-analyzer-get-lines-indent-alternative-if ()
   "Test for alternative if indentations."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true):\n    echo 'Something';\nelseif (true):\n    echo 
'Something';\nelse:\n    echo 'Something else';\n    echo 'Something else 
again';\nendif;\necho true;\n"
    "Alternative control structures"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (1 0)) (9 (0 0)) (10 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (1 0)) (9 (0 0)) (10 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true):\n    echo 'Something';\nelseif (true\n    && true\n):\n  
  echo 'Something';\nelse:\n    echo 'Something else';\n    echo 'Something 
else again';\nendif;\necho true;\n"
    "Alternative control structures with multi-line elseif 1"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0)) (9 (1 0)) (10 (1 0)) (11 (0 0)) (12 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0)) (7 (1 0)) (8 (0 0)) (9 (1 0)) (10 (1 0)) (11 (0 0)) (12 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true):\n    echo 'Something';\nelseif (true\n    && true):\n    
echo 'Something';\nelse:\n    echo 'Something else';\n    echo 'Something else 
again';\nendif;\necho true;\n"
    "Alternative control structures with multi-line elseif 2"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (1 
0)) (7 (0 0)) (8 (1 0)) (9 (1 0)) (10 (0 0)) (11 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (1 
0)) (7 (0 0)) (8 (1 0)) (9 (1 0)) (10 (0 0)) (11 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
   )
 
-(defun phps-mode-test-functions-get-lines-indent-classes ()
+(defun phps-mode-test-lex-analyzer-get-lines-indent-classes ()
   "Test for class indent."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace\n{\n    class myClass\n    {\n        public 
function myFunction()\n        {\n            echo 'my statement';\n        }\n 
   }\n}\n"
    "Regular PHP with namespaces, classes and functions"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0)) (6 (2 
0)) (7 (2 0)) (8 (3 0)) (9 (2 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0)) (6 (2 
0)) (7 (2 0)) (8 (3 0)) (9 (2 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace\n{\n    class myClass {\n        public 
function myFunction()\n        {\n            echo 'my statement';\n        }\n 
   }\n}\n"
    "Regular PHP with namespaces, classes and functions"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (2 0)) (6 (2 
0)) (7 (3 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (2 0)) (6 (2 
0)) (7 (3 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nclass MyClass extends MyAbstract implements\n    myInterface,\n    
myInterface2\n{\n}\n"
    "Class multi-line implements"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nclass MyClass\n    extends MyAbstract\n    implements myInterface, 
myInterface2\n{\n}\n"
    "Class multi-line extends and implements"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n *\n */\nnamespace Aomebo\n{\n    /**\n     *\n     */\n    
class Base\n    {\n    }\n}\n"
    "Namespace and class with doc-comments"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1)) (5 (0 0)) (6 (0 
0)) (7 (1 0)) (8 (1 1)) (9 (1 1)) (10 (1 0)) (11 (1 0)) (12 (1 0)) (13 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1)) (5 (0 0)) (6 (0 
0)) (7 (1 0)) (8 (1 1)) (9 (1 1)) (10 (1 0)) (11 (1 0)) (12 (1 0)) (13 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
   )
 
-(defun phps-mode-test-functions-get-lines-indent-if ()
+(defun phps-mode-test-lex-analyzer-get-lines-indent-if ()
   "Test for multi-line if expressions."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (\n    true\n    && true\n) {\n    echo 'was here';\n}\n"
    "If expression spanning multiple lines 1"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (1 
0)) (7 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n// Can we load configuration?\nif ($configuration::load(\n    
self::getParameter(self::PARAMETER_CONFIGURATION_INTERNAL_FILENAME),\n    
self::getParameter(self::PARAMETER_CONFIGURATION_EXTERNAL_FILENAME),\n    
self::getParameter(self::PARAMETER_STRUCTURE_INTERNAL_FILENAME),\n    
self::getParameter(self::PARAMETER_STRUCTURE_EXTERNAL_FILENAME)\n)) {\n    echo 
'was here';\n}\n"
    "If expression spanning multiple lines 2"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0)) (6 (1 
0)) (7 (1 0)) (8 (0 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0)) (6 (1 
0)) (7 (1 0)) (8 (0 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true) {\n    if ($configuration::load(\n        
self::getParameter(self::PARAMETER_CONFIGURATION_INTERNAL_FILENAME),\n        
self::getParameter(self::PARAMETER_CONFIGURATION_EXTERNAL_FILENAME),\n        
self::getParameter(self::PARAMETER_STRUCTURE_INTERNAL_FILENAME),\n        
self::getParameter(self::PARAMETER_STRUCTURE_EXTERNAL_FILENAME))\n    ) {\n     
   echo 'was here';\n    }\n}\n"
    "If expression spanning multiple lines 3"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (2 
0)) (7 (2 0)) (8 (1 0)) (9 (2 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (2 
0)) (7 (2 0)) (8 (1 0)) (9 (2 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myFunction(true)\n) {\n    echo 'was here';\n}\n"
    "If expression spanning multiple lines 4"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myFunction(\n    true)\n) {\n    echo 'was here';\n}\n"
    "If expression spanning multiple lines 5"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true) {\n    if (myFunction(\n        true)\n    ) {\n        
echo 'was here';\n    }\n}\n"
    "Nested if expression spanning multiple lines 6"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (2 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (2 
0)) (7 (1 0)) (8 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html><head><title><?php if ($myCondition) {\n    if ($mySeconCondition) 
{\n        echo $title2;\n\n    } ?></title><body>Bla bla</body></html>"
    "Mixed HTML/PHP with if expression and token-less lines"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (1 0)) (3 (2 0)) (4 (2 0)) (5 (1 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (1 0)) (3 (2 0)) (4 (2 0)) (5 (1 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html><head><title><?php\nif ($myCondition) {\n    if ($mySecondCondition) 
{\n        echo $title;\n    } else if ($mySecondCondition) {\n        echo 
$title4;\n    } else {\n        echo $title2;\n        echo $title3;\n    }\n} 
?></title><body>Bla bla</body></html>"
    "Mixed HTML/PHP with if expression 2"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (2 
0)) (7 (1 0)) (8 (2 0)) (9 (2 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (2 
0)) (7 (1 0)) (8 (2 0)) (9 (2 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myFirstCondition()) {\n    $this->var = 'abc123';\n} else {\n   
 $this->var = 'def456';\n}\n"
    "Regular else expression indent calculation"
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0 
0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
   )
 
-(defun phps-mode-test-functions-get-lines-indent-switch-case ()
+(defun phps-mode-test-lex-analyzer-get-lines-indent-switch-case ()
   "Test for switch-case indentation."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nswitch ($condition) {\n    case true:\n        echo 'here';\n       
 echo 'here 2';\n    case false:\n        echo 'here 4';\n    default:\n        
echo 'here 3';\n}\n"
    "Switch, case, default"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 
0)) (7 (2 0)) (8 (1 0)) (9 (2 0)) (10 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 
0)) (7 (2 0)) (8 (1 0)) (9 (2 0)) (10 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nswitch ($condition):\n    case true:\n        echo 'here';\n        
echo 'here 2';\n    case false:\n        echo 'here 4';\n    default:\n        
echo 'here 3';\nendswitch;\n"
    "Switch, case, default with alternative control structure"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 
0)) (7 (2 0)) (8 (1 0)) (9 (2 0)) (10 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (1 
0)) (7 (2 0)) (8 (1 0)) (9 (2 0)) (10 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true) {\n    switch ($condition):\n        case true:\n         
   echo 'here';\n            echo 'here 2';\n        case false:\n            
echo 'here 4';\n        default:\n            echo 'here 3';\n    endswitch;\n  
  sprintf(__(\n        'Error: %s',\n        $error\n    ));\n}\n"
    "Alternative switch, case, default with exception after it"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (3 0)) (6 (3 
0)) (7 (2 0)) (8 (3 0)) (9 (2 0)) (10 (3 0)) (11 (1 0)) (12 (1 0)) (13 (2 0)) 
(14 (2 0)) (15 (1 0)) (16 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (3 0)) (6 (3 
0)) (7 (2 0)) (8 (3 0)) (9 (2 0)) (10 (3 0)) (11 (1 0)) (12 (1 0)) (13 (2 0)) 
(14 (2 0)) (15 (1 0)) (16 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (true) {\n    switch ($condition) {\n        case true:\n        
    echo 'here';\n            echo 'here 2';\n        case false:\n            
echo 'here 4';\n        default:\n            echo 'here 3';\n    }\n    
sprintf(__(\n        'Error: %s',\n        $error\n    ));\n}\n"
    "Curly switch, case, default with exception after it"
-   ;; (message "Indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (3 0)) (6 (3 
0)) (7 (2 0)) (8 (3 0)) (9 (2 0)) (10 (3 0)) (11 (1 0)) (12 (1 0)) (13 (2 0)) 
(14 (2 0)) (15 (1 0)) (16 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   ;; (message "Indent: %s" (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (3 0)) (6 (3 
0)) (7 (2 0)) (8 (3 0)) (9 (2 0)) (10 (3 0)) (11 (1 0)) (12 (1 0)) (13 (2 0)) 
(14 (2 0)) (15 (1 0)) (16 (0 0))) (phps-mode-test--hash-to-list 
(phps-mode-lex-analyzer--get-lines-indent)))))
 
   )
 
-(defun phps-mode-test-functions-indent-line ()
+(defun phps-mode-test-lex-analyzer-indent-line ()
   "Test for indentation."
 
   ;; Curly bracket tests
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition) 
{\necho $title;\n\n} ?></title><body>Bla bla</body></html>"
    "Curly bracket test"
    (goto-char 69)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<html><head><title><?php if 
($myCondition) {\n    if ($mySeconCondition) {\necho $title;\n\n} 
?></title><body>Bla bla</body></html>"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition) 
{\necho $title1;\n} ?></title><body>Bla bla</body></html>"
    "Curly bracket test 2"
    (goto-char 75)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<html><head><title><?php if 
($myCondition) {\nif ($mySeconCondition) {\n        echo $title1;\n} 
?></title><body>Bla bla</body></html>"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition) 
{\necho $title2;\n\n} ?></title><body>Bla bla</body></html>"
    "Curly bracket test 3"
    (goto-char 98)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<html><head><title><?php if 
($myCondition) {\nif ($mySeconCondition) {\necho $title2;\n\n    } 
?></title><body>Bla bla</body></html>"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition) 
{\necho $title3;\n\n}\n?>\n</title><body>Bla bla</body></html>"
    "Curly bracket test 4"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
    (goto-char 110)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<html><head><title><?php if 
($myCondition) {\nif ($mySeconCondition) {\necho $title3;\n\n}\n?>\n    
</title><body>Bla bla</body></html>"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$variable = array(\n'random3'\n);\n$variable = true;\n"
    "Assignment test 1"
    (goto-char 28)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\n$variable = array(\n    
'random3'\n);\n$variable = true;\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$variable = array(\n    'random2'\n    );\n$variable = true;\n"
    "Assignment test 2"
    (goto-char 43)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\n$variable = array(\n    
'random2'\n);\n$variable = true;\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n* My first line\n* My second line\n**/\n"
    "Doc-comment test 1"
    (goto-char 20)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\n/**\n * My first line\n* My 
second line\n**/\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n* My first line\n* My second line\n**/\n"
    "Doc-comment test 2"
    (goto-char 9)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\n/**\n* My first line\n* My second 
line\n**/\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n* My first line\n* My second line\n**/\n"
    "Doc-comment test 3"
    (goto-char 46)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\n/**\n* My first line\n* My second 
line\n **/\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$variable = array(\n  'random4');\n$variable = true;\n"
    "Round bracket test 1"
    (goto-char 30)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\n$variable = array(\n    
'random4');\n$variable = true;\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nadd_filter(\n\"views_{$screen->id}\",'__return_empty_array'\n);"
    "Round bracket test 2"
    (goto-char 25)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nadd_filter(\n    
\"views_{$screen->id}\",'__return_empty_array'\n);"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (random_expression(\ntrue\n)) {\nsome_logic_here();\n}"
    "Round bracket test 3"
    (goto-char 36)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif (random_expression(\ntrue\n)) 
{\nsome_logic_here();\n}"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (empty(\n$this->var\n) && !empty($this->var)\n) {\n$this->var = 
'abc123';\n}\n"
    "Nested if-expression"
    (goto-char 54)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\nif (empty(\n$this->var\n) && 
!empty($this->var)\n) {\n$this->var = 'abc123';\n}\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myFirstCondition()) {\n    $this->var = 'abc123';\n    } else 
{\n    $this->var = 'def456';\n}\n"
    "Regular else expression"
    (goto-char 68)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif (myFirstCondition()) {\n    
$this->var = 'abc123';\n} else {\n    $this->var = 'def456';\n}\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myFirstCondition()) {\n    $this->var = 'abc123';\n    } else 
if (mySeconCondition()) {\n    $this->var = 'def456';\n}\n"
    "Regular else if test"
    (goto-char 68)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif (myFirstCondition()) {\n    
$this->var = 'abc123';\n} else if (mySeconCondition()) {\n    $this->var = 
'def456';\n}\n"))))
 
   ;; Square bracket
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = [\n    'random' => [\n        'hello',\n],\n];\n"
    "Square bracket test 1"
    (goto-char 51)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n$var = [\n    'random' => [\n      
  'hello',\n    ],\n];\n"))))
   
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myRandomCondition()):\necho 'Something here';\n    else:\n    
echo 'Something else here 8';\nendif;\n"
    "Alternative else test"
    (goto-char 62)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    ;; (message "Tokens %s" phps-mode-lexer-tokens)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif (myRandomCondition()):\necho 
'Something here';\nelse:\n    echo 'Something else here 8';\nendif;\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nswitch (myRandomCondition()) {\ncase 'Something here':\necho 
'Something else here';\n}\n"
    "Switch case indentation test"
    (goto-char 45)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nswitch (myRandomCondition()) {\n   
 case 'Something here':\necho 'Something else here';\n}\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nswitch (myRandomCondition()): \ncase 'Something here':\necho 
'Something else here';\nendswitch;\n"
    "Alternative switch case indentation test 2"
    (goto-char 70)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nswitch (myRandomCondition()): 
\ncase 'Something here':\n        echo 'Something else here';\nendswitch;\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myRandomCondition())\necho 'Something here';\necho 'Something 
else here';\n"
    "Inline control structure indentation"
    (goto-char 40)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif (myRandomCondition())\n    echo 
'Something here';\necho 'Something else here';\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myRandomCondition())\n    echo 'Something here';\n    echo 
'Something else here';\n"
    "Inline control structure indentation 2"
    (goto-char 60)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif (myRandomCondition())\n    echo 
'Something here';\necho 'Something else here';\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (myRandomCondition()):\necho 'Something here';\n    echo 
'Something else here';\nendif;\n"
    "Alternative control structure indentation 1"
    (goto-char 40)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif (myRandomCondition()):\n    
echo 'Something here';\n    echo 'Something else here';\nendif;\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nmyFunction(\n    array(\n        'random' => 'abc',\n        ),\n   
 $var5\n);\n"
    "Function arguments with associate array indentation"
    (goto-char 65)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nmyFunction(\n    array(\n        
'random' => 'abc',\n    ),\n    $var5\n);\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = $var2->getHead()\n->getTail();\n"
    "Multi-line assignment indentation test 1"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
    (goto-char 35)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n$var = $var2->getHead()\n    
->getTail();\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var =\n'random string';\n"
    "Single-line assignment indentation test"
    (goto-char 20)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n$var =\n    'random string';\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (empty($this->var)):\n$this->var = 'abc123';\n    endif;"
    "Alternative control structure if expression"
    (goto-char 60)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif 
(empty($this->var)):\n$this->var = 'abc123';\nendif;"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nif (empty($this->var)):\n$this->var = 'abc123';\nendif;"
    "Alternative control structure test"
    (goto-char 35)
-   (phps-mode-functions-indent-line)
+   (phps-mode-lex-analyzer--indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nif (empty($this->var)):\n    
$this->var = 'abc123';\nendif;"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html>\n<head>\n<title><?php echo $title; 
?></title>\n</head>\n<body>\n<div class=\"contents\"><?php echo $body; 
?></div>\n</body>\n</html>"
    "A mixed HTML and PHP file, each PHP command is inside HTML markup"
    (indent-region (point-min) (point-max))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<html>\n    <head>\n        <title><?php 
echo $title; ?></title>\n    </head>\n    <body>\n        <div 
class=\"contents\"><?php echo $body; ?></div>\n    </body>\n</html>"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html>\n<head>\n<title><?php echo $title; ?></title>\n</head>\n<body 
class=\"<?php echo $class; ?>\">\n<div class=\"contents\"><?php echo $body; 
?></div>\n</body>\n</html>"
    "A mixed HTML and PHP file, each PHP command is inside HTML markup, one PHP 
inside markup tag"
    (indent-region (point-min) (point-max))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<html>\n    <head>\n        <title><?php 
echo $title; ?></title>\n    </head>\n    <body class=\"<?php echo $class; 
?>\">\n        <div class=\"contents\"><?php echo $body; ?></div>\n    
</body>\n</html>"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html>\n    <head>\n        <title><?php $myTitle; ?></title>\n    
</head>\n    <body>\n        <?php echo 'test'; ?>\n        <h1>My title</h1>\n 
       <?php if ($myTest): ?>\n        <div>\n            A lot of other 
stuff.\n        </div>\n        <?php endif; ?>\n    </body>\n</html>"
    "Indent mixed HTML and one-line PHP lines."
    (indent-region (point-min) (point-max))
@@ -1102,141 +1102,141 @@
 
   )
 
-(defun phps-mode-test-functions-imenu ()
+(defun phps-mode-test-lex-analyzer-imenu ()
   "Test for imenu."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n$var = 
function () {\n    echo 'here';\n};"
    "Imenu function-oriented file with anonymous function"
-   (should (equal (phps-mode-functions-get-imenu) '(("myFunctionA" . 16) 
("myFunctionB" . 42)))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myFunctionA" . 16) 
("myFunctionB" . 42)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n"
    "Imenu function-oriented file"
-   (should (equal (phps-mode-functions-get-imenu) '(("myFunctionA" . 16) 
("myFunctionB" . 42)))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myFunctionA" . 16) 
("myFunctionB" . 42)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nclass myClass {\n    public function myFunctionA() {}\n    
protected function myFunctionB() {}\n}\n"
    "Imenu object-oriented file"
-   (should (equal (phps-mode-functions-get-imenu) '(("myClass" . 
(("myFunctionA" . 43) ("myFunctionB" . 83)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myClass" . 
(("myFunctionA" . 43) ("myFunctionB" . 83)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\ninterface myInterface {\n    public function myFunctionA() {}\n    
protected function myFunctionB() {}\n}\n"
    "Imenu object-oriented file with interface"
-   (should (equal (phps-mode-functions-get-imenu) '(("myInterface" . 
(("myFunctionA" . 51) ("myFunctionB" . 91)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myInterface" . 
(("myFunctionA" . 51) ("myFunctionB" . 91)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace {\n    class myClass {\n        public 
function myFunctionA() {}\n        protected function myFunctionB() {}\n    
}\n}\n"
    "Imenu object-oriented file with namespace, class and function"
-   (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass" 
("myFunctionA" . 75) ("myFunctionB" . 119)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myNamespace" 
("myClass" ("myFunctionA" . 75) ("myFunctionB" . 119)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;\nclass myClass {\n    public function 
myFunctionA() {}\n    protected function myFunctionB() {}\n}\n"
    "Imenu object-oriented file with bracket-less namespace, class and function"
-   (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass" 
("myFunctionA" . 66) ("myFunctionB" . 106)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myNamespace" 
("myClass" ("myFunctionA" . 66) ("myFunctionB" . 106)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace {\n    class myClass extends myAbstract {\n   
     public function myFunctionA() {}\n        protected function myFunctionB() 
{}\n    }\n}\n"
    "Imenu object-oriented file with namespace, class that extends and 
functions"
-   (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass" 
("myFunctionA" . 94) ("myFunctionB" . 138)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myNamespace" 
("myClass" ("myFunctionA" . 94) ("myFunctionB" . 138)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements 
myInterface {\n    public function myFunctionA() {}\n    protected function 
myFunctionB() {}\n}\n"
    "Imenu object-oriented file with bracket-less namespace, class that extends 
and implements and functions"
-   (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass" 
("myFunctionA" . 108) ("myFunctionB" . 148)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myNamespace" 
("myClass" ("myFunctionA" . 108) ("myFunctionB" . 148)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements 
myInterface {\n    public function myFunctionA($myArg = null) {}\n    protected 
function myFunctionB($myArg = 'abc') {}\n}\n"
    "Imenu object-oriented file with bracket-less namespace, class that extends 
and implements and functions with optional arguments"
-   (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass" 
("myFunctionA" . 108) ("myFunctionB" . 161)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myNamespace" 
("myClass" ("myFunctionA" . 108) ("myFunctionB" . 161)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace\\myNamespace2;\nclass myClass extends 
myAbstract implements myInterface {\n    public function myFunctionA($myArg = 
null) {}\n    protected function myFunctionB($myArg = 'abc') {}\n}\n"
    "Imenu object-oriented file with bracket-less namespace with multiple 
levels, class that extends and implements and functions with optional arguments"
-   (should (equal (phps-mode-functions-get-imenu) 
'(("myNamespace\\myNamespace2" ("myClass" ("myFunctionA" . 121) ("myFunctionB" 
. 174)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) 
'(("myNamespace\\myNamespace2" ("myClass" ("myFunctionA" . 121) ("myFunctionB" 
. 174)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nclass myClass\n{\n\n    public function myFunction1()\n    {\n      
  echo \"my string with variable {$variable} inside it\";\n    }\n\n    public 
function myFunction2()\n    {\n    }\n\n}"
    "Imenu with double quoted string with variable inside it"
-   (should (equal (phps-mode-functions-get-imenu) '(("myClass" ("myFunction1" 
. 44) ("myFunction2" . 153))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myClass" 
("myFunction1" . 44) ("myFunction2" . 153))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n\nnamespace MyNamespace;\n\nclass MyClass\n{\n\n    /**\n     *\n   
  */\n    public function __construct()\n    {\n        if ($test) {\n        
}\n    }\n\n    /**\n     *\n     */\n    public function myFunction1()\n    
{\n        $this->addMessage(\"My random {$message} here\" . ($random > 1 ? 
\"A\" : \"\") . \" was here.\");\n    }\n    \n    /**\n     *\n     */\n    
public function myFunction2()\n    {\n    }\n\n    /**\n     * It's good\n     
*/\n    public function my [...]
    "Imenu with double quoted string with variable inside it and concatenated 
string"
-   (should (equal (phps-mode-functions-get-imenu) '(("MyNamespace" ("MyClass" 
("__construct" . 92) ("myFunction1" . 193) ("myFunction2" . 365) ("myFunction3" 
. 445) ("myFunction4" . 515)))))))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) '(("MyNamespace" 
("MyClass" ("__construct" . 92) ("myFunction1" . 193) ("myFunction2" . 365) 
("myFunction3" . 445) ("myFunction4" . 515)))))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nclass myClass {}"
    "Imenu empty class"
-   (should (equal (phps-mode-functions-get-imenu) nil)))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) nil)))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace {}"
    "Imenu empty bracketed namespace"
-   (should (equal (phps-mode-functions-get-imenu) nil)))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) nil)))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;"
    "Imenu empty namespace without brackets"
-   (should (equal (phps-mode-functions-get-imenu) nil)))
+   (should (equal (phps-mode-lex-analyzer--get-imenu) nil)))
 
   )
 
-(defun phps-mode-test-functions-get-moved-imenu ()
+(defun phps-mode-test-lex-analyzer-get-moved-imenu ()
   "Test for moving imenu index."
 
-  ;; (message "Moved imenu %s" (phps-mode-functions-get-moved-imenu 
'(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" . 161)))) 0 2))
+  ;; (message "Moved imenu %s" (phps-mode-lex-analyzer--get-moved-imenu 
'(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" . 161)))) 0 2))
 
   (should (equal
            '(("myNamespace" ("myClass" ("myFunctionA" . 110) ("myFunctionB" . 
163))))
-           (phps-mode-functions-get-moved-imenu '(("myNamespace" ("myClass" 
("myFunctionA" . 108) ("myFunctionB" . 161)))) 0 2)))
+           (phps-mode-lex-analyzer--get-moved-imenu '(("myNamespace" 
("myClass" ("myFunctionA" . 108) ("myFunctionB" . 161)))) 0 2)))
 
   (should (equal
            '(("myNamespace" ("myClass" ("myFunctionA" . 106) ("myFunctionB" . 
159))))
-           (phps-mode-functions-get-moved-imenu '(("myNamespace" ("myClass" 
("myFunctionA" . 108) ("myFunctionB" . 161)))) 0 -2)))
+           (phps-mode-lex-analyzer--get-moved-imenu '(("myNamespace" 
("myClass" ("myFunctionA" . 108) ("myFunctionB" . 161)))) 0 -2)))
 
   (should (equal
            '(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" . 
171))))
-           (phps-mode-functions-get-moved-imenu '(("myNamespace" ("myClass" 
("myFunctionA" . 108) ("myFunctionB" . 161)))) 110 10)))
+           (phps-mode-lex-analyzer--get-moved-imenu '(("myNamespace" 
("myClass" ("myFunctionA" . 108) ("myFunctionB" . 161)))) 110 10)))
 
   (should (equal
            '(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" . 
161))))
-           (phps-mode-functions-get-moved-imenu '(("myNamespace" ("myClass" 
("myFunctionA" . 108) ("myFunctionB" . 161)))) 180 10)))
+           (phps-mode-lex-analyzer--get-moved-imenu '(("myNamespace" 
("myClass" ("myFunctionA" . 108) ("myFunctionB" . 161)))) 180 10)))
 
   )
 
-(defun phps-mode-test-functions-comment-uncomment-region ()
+(defun phps-mode-test-lex-analyzer-comment-uncomment-region ()
   "Test (comment-region) and (uncomment-region)."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements 
myInterface {\n    public function myFunctionA($myArg = null) {}\n    protected 
function myFunctionB($myArg = 'abc') {}\n}\n"
    "Comment object-oriented file with bracket-less namespace, class that 
extends and implements and functions with optional arguments"
    (comment-region (point-min) (point-max))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n/* namespace myNamespace;\nclass 
myClass extends myAbstract implements myInterface {\n    public function 
myFunctionA($myArg = null) {}\n    protected function myFunctionB($myArg = 
'abc') {}\n} */\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements 
myInterface {\n    public function myFunctionA($myArg = null) {}\n    protected 
function myFunctionB($myArg = 'abc') {}\n}\n"
    "Comment part of object-oriented file with bracket-less namespace, class 
that extends and implements and functions with optional arguments"
    (comment-region 62 86)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nnamespace myNamespace;\nclass 
myClass extends myAbstract /* implements myInterface */ {\n    public function 
myFunctionA($myArg = null) {}\n    protected function myFunctionB($myArg = 
'abc') {}\n}\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "// <?php\n// namespace myNamespace;\n// class myClass extends myAbstract 
implements myInterface {\n//    public function myFunctionA($myArg = null) 
{}\n//    protected function myFunctionB($myArg = 'abc') {}\n//}\n"
    "Uncomment object-oriented file with bracket-less namespace, class that 
extends and implements and functions with optional arguments"
    (uncomment-region (point-min) (point-max))
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "// <?php\n namespace myNamespace;\n class 
myClass extends myAbstract implements myInterface {\n    public function 
myFunctionA($myArg = null) {}\n    protected function myFunctionB($myArg = 
'abc') {}\n}\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract/*  
implements myInterface  */{\n    public function myFunctionA($myArg = null) 
{}\n    protected function myFunctionB($myArg = 'abc') {}\n}\n"
    "Uncomment part of object-oriented file with bracket-less namespace, class 
that extends and implements and functions with optional arguments"
    (uncomment-region 62 92)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nnamespace myNamespace;\nclass 
myClass extends myAbstract implements myInterface {\n    public function 
myFunctionA($myArg = null) {}\n    protected function myFunctionB($myArg = 
'abc') {}\n}\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract/*  
implements myInterface  */{\n    // public function myFunctionA($myArg = null) 
{}\n    protected function myFunctionB($myArg = 'abc') {}\n}"
    "Comment region were some of the region is already commented-out"
    ;; (message "Tokens %s" phps-mode-lexer-tokens)
@@ -1244,7 +1244,7 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n/* namespace myNamespace;\nclass 
myClass extends myAbstract *//*  implements myInterface  *//* { */\n    // 
public function myFunctionA($myArg = null) {}\n    /* protected function 
myFunctionB($myArg = 'abc') {}\n} */"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract/*  
implements myInterface  */{\n    public function myFunctionA($myArg = null) 
{}\n    /* protected function myFunctionB($myArg = 'abc') {} */\n}"
    "Un-comment region were some of the region is already un-commented"
    ;; (message "Tokens %s" phps-mode-lexer-tokens)
@@ -1252,7 +1252,7 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\nnamespace myNamespace;\nclass 
myClass extends myAbstract implements myInterface {\n    public function 
myFunctionA($myArg = null) {}\n    protected function myFunctionB($myArg = 
'abc') {}\n}"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/**\n * My doc comment\n */\n$var = 'abc';\n"
    "Comment region were some of the region is in doc comment"
    ;; (message "Tokens %s" phps-mode-lexer-tokens)
@@ -1260,7 +1260,7 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n/**\n * My doc comment\n */\n/* 
$var = 'abc'; */\n"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/** $var = '123'; */\n$var = 'abc';\n"
    "Un-comment region were some of the region is already un-commented"
    ;; (message "Tokens %s" phps-mode-lexer-tokens)
@@ -1270,12 +1270,12 @@
 
   )
 
-(defun phps-mode-test-functions-get-inline-html-indentation ()
+(defun phps-mode-test-lex-analyzer-get-inline-html-indentation ()
   "Test function."
 
   (should (equal
            '(0 1 2 1 1 2 1 0)
-           (nth 0 (phps-mode-functions--get-inline-html-indentation
+           (nth 0 (phps-mode-lex-analyzer--get-inline-html-indentation
                    
"<html>\n<head>\n<title>MyTitle</title>\n</head>\n<body>\n<p>My 
paragraph</p>\n</body>\n</html>"
                    0
                    0
@@ -1286,7 +1286,7 @@
 
   (should (equal
            '(2 2 1 0)
-           (nth 0 (phps-mode-functions--get-inline-html-indentation
+           (nth 0 (phps-mode-lex-analyzer--get-inline-html-indentation
                    "\n<p>My paragraph</p>\n</body>\n</html>"
                    2
                    2
@@ -1297,7 +1297,7 @@
 
   (should (equal
            '(0)
-           (nth 0 (phps-mode-functions--get-inline-html-indentation
+           (nth 0 (phps-mode-lex-analyzer--get-inline-html-indentation
                    "<html>"
                    0
                    0
@@ -1308,7 +1308,7 @@
 
   (should (equal
            '(0 1 2 1 0)
-           (nth 0 (phps-mode-functions--get-inline-html-indentation
+           (nth 0 (phps-mode-lex-analyzer--get-inline-html-indentation
                    "<script type=\"text/javascript\">\n    if (something()) 
{\n        alert('Something here');\n    }\n</script>\n"
                    0
                    0
@@ -1321,29 +1321,29 @@
 
 
 
-(defun phps-mode-test-functions ()
+(defun phps-mode-test-lex-analyzer ()
   "Run test for functions."
   ;; (setq debug-on-error t)
-  (phps-mode-test-functions-process-changes)
-  (phps-mode-test-functions-alternative-indentation)
-  (phps-mode-test-functions-move-lines-indent)
-  (phps-mode-test-functions-get-inline-html-indentation)
-  (phps-mode-test-functions-get-lines-indent-if)
-  (phps-mode-test-functions-get-lines-indent-classes)
-  (phps-mode-test-functions-get-lines-indent-inline-if)
-  (phps-mode-test-functions-get-lines-indent-alternative-if)
-  (phps-mode-test-functions-get-lines-indent-multi-line-assignments)
-  (phps-mode-test-functions-get-lines-indent-switch-case)
-  (phps-mode-test-functions-get-lines-indent-psr-2)
-  (phps-mode-test-functions-get-lines-indent)
-  (phps-mode-test-functions-indent-line)
-  (phps-mode-test-functions-imenu)
-  (phps-mode-test-functions-get-moved-imenu)
-  (phps-mode-test-functions-comment-uncomment-region)
-  (phps-mode-test-functions-move-lines-indent))
-
-(phps-mode-test-functions)
-
-(provide 'phps-mode-test-functions)
-
-;;; phps-mode-test-functions.el ends here
+  (phps-mode-test-lex-analyzer-process-changes)
+  (phps-mode-test-lex-analyzer-alternative-indentation)
+  (phps-mode-test-lex-analyzer-move-lines-indent)
+  (phps-mode-test-lex-analyzer-get-inline-html-indentation)
+  (phps-mode-test-lex-analyzer-get-lines-indent-if)
+  (phps-mode-test-lex-analyzer-get-lines-indent-classes)
+  (phps-mode-test-lex-analyzer-get-lines-indent-inline-if)
+  (phps-mode-test-lex-analyzer-get-lines-indent-alternative-if)
+  (phps-mode-test-lex-analyzer-get-lines-indent-multi-line-assignments)
+  (phps-mode-test-lex-analyzer-get-lines-indent-switch-case)
+  (phps-mode-test-lex-analyzer-get-lines-indent-psr-2)
+  (phps-mode-test-lex-analyzer-get-lines-indent)
+  (phps-mode-test-lex-analyzer-indent-line)
+  (phps-mode-test-lex-analyzer-imenu)
+  (phps-mode-test-lex-analyzer-get-moved-imenu)
+  (phps-mode-test-lex-analyzer-comment-uncomment-region)
+  (phps-mode-test-lex-analyzer-move-lines-indent))
+
+(phps-mode-test-lex-analyzer)
+
+(provide 'phps-mode-test-lex-analyzer)
+
+;;; phps-mode-test-lex-analyzer.el ends here
diff --git a/test/phps-mode-test-lexer.el b/test/phps-mode-test-lexer.el
index 1437e06..89c6e38 100644
--- a/test/phps-mode-test-lexer.el
+++ b/test/phps-mode-test-lexer.el
@@ -29,355 +29,370 @@
 (require 'phps-mode)
 (require 'phps-mode-test)
 
-(defun phps-mode-test-lexer-script-boundaries ()
+(defun phps-mode-test-lexer--script-boundaries ()
   "Run test for lexer."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\t$öar=1; exit $var;\t?>"
    "Simple PHP with two expression"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 11 . 12) 
(T_LNUMBER 12 . 13) (";" 13 . 14) (T_EXIT 15 . 19) (T_VARIABLE 20 . 24) (";" 24 
. 25) (";" 26 . 28) (T_CLOSE_TAG 26 . 28)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nexit;\n?>"
    "Minimal PHP expression"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_EXIT 7 . 11) (";" 11 . 12) (";" 13 . 
15) (T_CLOSE_TAG 13 . 15)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php exit; ?>"
    "Small PHP file"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_EXIT 7 . 11) (";" 11 . 12) (";" 13 . 
15) (T_CLOSE_TAG 13 . 15)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<html><head>blabla</head<body>\n\n \t<?php\nexit;\n?>\n\n</body></html>"
    "Mixed inline HTML and PHP"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_INLINE_HTML 1 . 35) (T_OPEN_TAG 35 . 41) (T_EXIT 41 . 
45) (";" 45 . 46) (";" 47 . 49) (T_CLOSE_TAG 47 . 49) (T_INLINE_HTML 49 . 
65)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "\n\n \t<html><title>echo 
\"Blaha\";</title><?php\n\n\nexit?>\n\n<html><random /></html><?php exit ?>"
    "Another mixed inline HTML and PHP"
-   (should (equal phps-mode-lexer-tokens
-                  '((T_INLINE_HTML 1 . 39) (T_OPEN_TAG 39 . 45) (T_EXIT 47 . 
51) (";" 51 . 53) (T_CLOSE_TAG 51 . 53) (T_INLINE_HTML 53 . 78) (T_OPEN_TAG 78 
. 84) (T_EXIT 84 . 88) (";" 89 . 91) (T_CLOSE_TAG 89 . 91)))))
+   (should (equal
+            phps-mode-lex-analyzer--tokens
+            '((T_INLINE_HTML 1 . 39) (T_OPEN_TAG 39 . 45) (T_EXIT 47 . 51) 
(";" 51 . 53) (T_CLOSE_TAG 51 . 53) (T_INLINE_HTML 53 . 78) (T_OPEN_TAG 78 . 
84) (T_EXIT 84 . 88) (";" 89 . 91) (T_CLOSE_TAG 89 . 91)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n\n$k = 'key';\n\necho \"\\$a['{$k}']\";"
    "A tricky case where variable inside double quote is escaped"
-   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
-                  '((T_OPEN_TAG 1 . 7) (T_VARIABLE 8 . 10) ("=" 11 . 12) 
(T_CONSTANT_ENCAPSED_STRING 13 . 18) (";" 18 . 19) (T_ECHO 21 . 25) ("\"" 26 . 
27) (T_ENCAPSED_AND_WHITESPACE 27 . 32) (T_CURLY_OPEN 32 . 33) (T_VARIABLE 33 . 
35) ("}" 35 . 36) (T_CONSTANT_ENCAPSED_STRING 36 . 38) ("\"" 38 . 39) (";" 39 . 
40)))))
+   ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal
+            phps-mode-lex-analyzer--tokens
+            '((T_OPEN_TAG 1 . 7) (T_VARIABLE 8 . 10) ("=" 11 . 12) 
(T_CONSTANT_ENCAPSED_STRING 13 . 18) (";" 18 . 19) (T_ECHO 21 . 25) ("\"" 26 . 
27) (T_ENCAPSED_AND_WHITESPACE 27 . 32) (T_CURLY_OPEN 32 . 33) (T_VARIABLE 33 . 
35) ("}" 35 . 36) (T_CONSTANT_ENCAPSED_STRING 36 . 38) ("\"" 38 . 39) (";" 39 . 
40)))))
 
   )
 
-(defun phps-mode-test-lexer-simple-tokens ()
+(defun phps-mode-test-lexer--simple-tokens ()
   "Run test for simple tokens."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo $vür = array('');"
    "Simple PHP via array declaration"
-   (should (equal phps-mode-lexer-tokens
-                  '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) 
("=" 17 . 18) (T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 
27) (")" 27 . 28) (";" 28 . 29)))))
+   (should
+    (equal
+     phps-mode-lex-analyzer--tokens
+     '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) ("=" 17 . 18) 
(T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 27) (")" 27 . 
28) (";" 28 . 29)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php if 
(empty($parameters[self::PARAMETER_CONFIGURATION_INTERNAL_FILENAME])) { 
$parameters[self::PARAMETER_CONFIGURATION_INTERNAL_FILENAME] = ''; }"
    "Complex PHP with conditional"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_EMPTY 11 
. 16) ("(" 16 . 17) (T_VARIABLE 17 . 28) ("[" 28 . 29) (T_STRING 29 . 33) 
(T_PAAMAYIM_NEKUDOTAYIM 33 . 35) (T_STRING 35 . 76) ("]" 76 . 77) (")" 77 . 78) 
(")" 78 . 79) ("{" 80 . 81) (T_VARIABLE 82 . 93) ("[" 93 . 94) (T_STRING 94 . 
98) (T_PAAMAYIM_NEKUDOTAYIM 98 . 100) (T_STRING 100 . 141) ("]" 141 . 142) ("=" 
143 . 144) (T_CONSTANT_ENCAPSED_STRING 145 . 147) (";" 147 . 148) ("}" 149 . 
150)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo $var = array(\"\");"
    "Simple PHP with empty array assignment"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) 
("=" 17 . 18) (T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 
27) (")" 27 . 28) (";" 28 . 29)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo $var = array('abc' => '123');"
    "Simple PHP with associative array assignment"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) 
("=" 17 . 18) (T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 
30) (T_DOUBLE_ARROW 31 . 33) (T_CONSTANT_ENCAPSED_STRING 34 . 39) (")" 39 . 40) 
(";" 40 . 41)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php $var = []; "
    "PHP with short-handed array declaration assignment"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) ("[" 
14 . 15) ("]" 15 . 16) (";" 16 . 17)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php $var = ''; $var = 'abc'; "
    "PHP with string assignments"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_CONSTANT_ENCAPSED_STRING 14 . 16) (";" 16 . 17) (T_VARIABLE 18 . 22) ("=" 23 
. 24) (T_CONSTANT_ENCAPSED_STRING 25 . 30) (";" 30 . 31)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nswitch (myRandomCondition()) {\ncase 'Something here':\necho 
'Something else here';\n}\n"
    "Switch case PHP"
-   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_SWITCH 7 . 13) ("(" 14 . 15) 
(T_STRING 15 . 32) ("(" 32 . 33) (")" 33 . 34) (")" 34 . 35) ("{" 36 . 37) 
(T_CASE 38 . 42) (T_CONSTANT_ENCAPSED_STRING 43 . 59) (":" 59 . 60) (T_ECHO 61 
. 65) (T_CONSTANT_ENCAPSED_STRING 66 . 87) (";" 87 . 88) ("}" 89 . 90)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php $var = \"\"; $var = \"abc\"; $var = \"abc\\def\\ghj\";"
    "PHP with three string assignments"
-   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_CONSTANT_ENCAPSED_STRING 14 . 16) (";" 16 . 17) (T_VARIABLE 18 . 22) ("=" 23 
. 24) (T_CONSTANT_ENCAPSED_STRING 25 . 30) (";" 30 . 31) (T_VARIABLE 32 . 36) 
("=" 37 . 38) (T_CONSTANT_ENCAPSED_STRING 39 . 52) (";" 52 . 53)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo isset($backtrace[1]['file']) ? 'yes' : 'no'; "
    "PHP with short-handed conditional echo"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_ISSET 12 . 17) ("(" 
17 . 18) (T_VARIABLE 18 . 28) ("[" 28 . 29) (T_LNUMBER 29 . 30) ("]" 30 . 31) 
("[" 31 . 32) (T_CONSTANT_ENCAPSED_STRING 32 . 38) ("]" 38 . 39) (")" 39 . 40) 
("?" 41 . 42) (T_CONSTANT_ENCAPSED_STRING 43 . 48) (":" 49 . 50) 
(T_CONSTANT_ENCAPSED_STRING 51 . 55) (";" 55 . 56)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php myFunction(); "
    "A single function call"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_STRING 7 . 17) ("(" 17 . 18) (")" 18 
. 19) (";" 19 . 20)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php // echo 'random';?><!--</div>-->"
    "Commented out PHP expression and inline-html"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_COMMENT 7 . 24) (";" 24 . 26) 
(T_CLOSE_TAG 24 . 26) (T_INLINE_HTML 26 . 39)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php //echo $contact_position;?><!--</div>-->"
    "Commented out PHP expression and inline-html 2"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_COMMENT 7 . 32) (";" 32 . 34) 
(T_CLOSE_TAG 32 . 34) (T_INLINE_HTML 34 . 47)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo isset($backtrace[1]['file']) ? 'yes' : 'no';\n//a random 
comment\n// another random comment\n/**\n * More comments\n* More\n **/\necho 
$backtrace; ?>"
    "Conditional echo, comment and doc-comment block"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_ISSET 12 . 17) ("(" 
17 . 18) (T_VARIABLE 18 . 28) ("[" 28 . 29) (T_LNUMBER 29 . 30) ("]" 30 . 31) 
("[" 31 . 32) (T_CONSTANT_ENCAPSED_STRING 32 . 38) ("]" 38 . 39) (")" 39 . 40) 
("?" 41 . 42) (T_CONSTANT_ENCAPSED_STRING 43 . 48) (":" 49 . 50) 
(T_CONSTANT_ENCAPSED_STRING 51 . 55) (";" 55 . 56) (T_COMMENT 57 . 75) 
(T_COMMENT 76 . 101) (T_DOC_COMMENT 102 . 134) (T_ECHO 135 . 139) (T_VARIABLE 
140 . 150) (";" 150 . 151) (";" 152 . 154)  [...]
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php forgerarray($arg1, $arg2)"
    "A function call containing keywords in its name"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_STRING 7 . 18) ("(" 18 . 19) 
(T_VARIABLE 19 . 24) ("," 24 . 25) (T_VARIABLE 26 . 31) (")" 31 . 32)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$username = $_GET['user'] ?? 
'nobody';\n$this->request->data['comments']['user_id'] ??= 'value';\n"
    "Coalescing comparison operator and coalescing assignment operator"
-   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 16) ("=" 17 . 18) 
(T_VARIABLE 19 . 24) ("[" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 31) ("]" 31 
. 32) (T_COALESCE 33 . 35) (T_CONSTANT_ENCAPSED_STRING 36 . 44) (";" 44 . 45) 
(T_VARIABLE 46 . 51) (T_OBJECT_OPERATOR 51 . 53) (T_STRING 53 . 60) 
(T_OBJECT_OPERATOR 60 . 62) (T_STRING 62 . 66) ("[" 66 . 67) 
(T_CONSTANT_ENCAPSED_STRING 67 . 77) ("]" 77 . 78) ("[" 78 . 79) 
(T_CONSTANT_ENCAPSED_STRING 79 . 88) ("]" 88 . 89) (T_COALESCE_EQUA [...]
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho $array['abc'];\necho \"My $array[12] random statement\";\n"
    "Long inside array offset"
-   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 18) 
("[" 18 . 19) (T_CONSTANT_ENCAPSED_STRING 19 . 24) ("]" 24 . 25) (";" 25 . 26) 
(T_ECHO 27 . 31) ("\"" 32 . 33) (T_ENCAPSED_AND_WHITESPACE 33 . 36) (T_VARIABLE 
36 . 43) (T_NUM_STRING 43 . 45) ("]" 45 . 46) (T_CONSTANT_ENCAPSED_STRING 46 . 
63) ("\"" 63 . 64) (";" 64 . 65)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n/*my comment */\n/** my doc comment */"
    "Comment vs doc-comment"
-   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_COMMENT 7 . 22) (T_DOC_COMMENT 23 . 
44)))))
 
-  ;; (phps-mode-test-with-buffer
+  ;; (phps-mode-test--with-buffer
   ;;  "<?php ??= $var EXIT die function return yield from yield try catch 
finally throw if elseif endif else while endwhile do for endfor foreach 
endforeach declare enddeclare instanceof as switch endswitch case default break 
continue goto echo print class interface trait extends implements :: \\ ... ?? 
new clone var (int) (integer) (real) (double) (float) (string) (binary) (array) 
(object) (boolean) (bool) (unset) eval include include_once require 
require_once namespace use insteadof gl [...]
   ;;  "All PHP tokens after each other"
-  ;;  (message "Tokens: %s" phps-mode-lexer-tokens)
-  ;;  (should (equal phps-mode-lexer-tokens
+  ;;  (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+  ;;  (should (equal phps-mode-lex-analyzer--tokens
   ;;                 '((T_OPEN_TAG 1 . 7) (T_COALESCE_EQUAL 7 . 10) 
(T_VARIABLE 11 . 15) (T_EXIT 16 . 20) (T_DIE 21 . 24) (T_FUNCTION 25 . 33) 
(T_RETURN 34 . 40) (T_YIELD_FROM 41 . 52) (T_YIELD 52 . 57) (T_TRY 58 . 61) 
(T_CATCH 62 . 67) (T_FINALLY 68 . 75) (T_THROW 76 . 81) (T_IF 82 . 84) 
(T_ELSEIF 85 . 91) (T_ENDIF 92 . 97) (T_ELSE 98 . 102) (T_WHILE 103 . 108) 
(T_ENDWHILE 109 . 117) (T_DO 118 . 120) (T_FOR 121 . 124) (T_ENDFOR 125 . 131) 
(T_FOREACH 132 . 139) (T_ENDFOREACH 140 . 150) ( [...]
 
 
   )
 
-(defun phps-mode-test-lexer-complex-tokens ()
+(defun phps-mode-test-lexer--complex-tokens ()
   "Run test for complex tokens."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php $var->property;"
    "Object property"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) (T_OBJECT_OPERATOR 
11 . 13) (T_STRING 13 . 21) (";" 21 . 22)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo \"My $variable is here\"; echo \"you know\";"
    "Double quoted strings with variables"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) ("\"" 12 . 13) 
(T_ENCAPSED_AND_WHITESPACE 13 . 16) (T_VARIABLE 16 . 25) 
(T_CONSTANT_ENCAPSED_STRING 25 . 33) ("\"" 33 . 34) (";" 34 . 35) (T_ECHO 36 . 
40) (T_CONSTANT_ENCAPSED_STRING 41 . 51) (";" 51 . 52)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo \"My ${variable} is here 1\";"
    "Double quoted string with variable"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) ("\"" 12 . 13) 
(T_ENCAPSED_AND_WHITESPACE 13 . 16) (T_DOLLAR_OPEN_CURLY_BRACES 16 . 18) 
(T_STRING_VARNAME 18 . 26) ("}" 26 . 27) (T_CONSTANT_ENCAPSED_STRING 27 . 37) 
("\"" 37 . 38) (";" 38 . 39)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo \"Mine {$first_variable} is here and my $second is there.\";"
    "Another double quoted string with variable"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) ("\"" 12 . 13) 
(T_ENCAPSED_AND_WHITESPACE 13 . 18) (T_CURLY_OPEN 18 . 19) (T_VARIABLE 19 . 34) 
("}" 34 . 35) (T_CONSTANT_ENCAPSED_STRING 35 . 51) (T_VARIABLE 51 . 58) 
(T_CONSTANT_ENCAPSED_STRING 58 . 68) ("\"" 68 . 69) (";" 69 . 70)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo \" Hello $variable[0], how are you?\";"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) ("\"" 12 . 13) 
(T_ENCAPSED_AND_WHITESPACE 13 . 20) (T_VARIABLE 20 . 30) (T_NUM_STRING 30 . 31) 
("]" 31 . 32) (T_CONSTANT_ENCAPSED_STRING 32 . 46) ("\"" 46 . 47) (";" 47 . 
48)))))
 
   ;; HEREDOC
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo <<<\"MYLABEL\"\nline 1\n line 2\nMYLABEL\n;"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_START_HEREDOC 12 . 
25) (T_ENCAPSED_AND_WHITESPACE 25 . 39) (T_END_HEREDOC 39 . 47) (";" 48 . 
49)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo <<<MYLABEL\nline 1\n line 2\nMYLABEL\n;"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_START_HEREDOC 12 . 
23) (T_ENCAPSED_AND_WHITESPACE 23 . 37) (T_END_HEREDOC 37 . 45) (";" 46 . 
47)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo <<<\"MYLABEL\"\nMYLABEL\n"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_START_HEREDOC 12 . 
25) (T_END_HEREDOC 25 . 33)))))
 
   ;; Test heredoc with variables $, {$, ${ here
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo <<<\"MYLABEL\"\nline 1 $variable1\n line 2\n${variable2} line 
3\n line {$variable3} here\nline 5 $variable[3] here\nMYLABEL;\n"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_START_HEREDOC 12 . 
25) (T_ENCAPSED_AND_WHITESPACE 25 . 32) (T_VARIABLE 32 . 42) 
(T_ENCAPSED_AND_WHITESPACE 42 . 51) (T_DOLLAR_OPEN_CURLY_BRACES 51 . 53) 
(T_STRING_VARNAME 53 . 62) ("}" 62 . 63) (T_ENCAPSED_AND_WHITESPACE 63 . 77) 
(T_CURLY_OPEN 77 . 78) (T_VARIABLE 78 . 88) ("}" 88 . 89) 
(T_ENCAPSED_AND_WHITESPACE 89 . 102) (T_VARIABLE 102 . 112) (T_NUM_STRING 112 . 
113) ("]" 113 . 114) (T_ENCAPSED_AND_WHITESPACE 114 . 119) (T_END_ [...]
 
   ;; Nowdoc
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo <<<'MYLABEL'\nline 1\n line 2\nMYLABEL;\n"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_START_HEREDOC 12 . 
25) (T_ENCAPSED_AND_WHITESPACE 25 . 39) (T_END_HEREDOC 39 . 47) (";" 47 . 
48)))))
 
   ;; Backquotes
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php `echo \"HELLO\"`;"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) ("`" 7 . 8) (T_CONSTANT_ENCAPSED_STRING 
8 . 20) ("`" 20 . 21) (";" 21 . 22)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php `echo \"HELLO $variable or {$variable2} or ${variable3} or 
$variable[index][0] here\"`;"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) ("`" 7 . 8) (T_CONSTANT_ENCAPSED_STRING 
8 . 20) (T_VARIABLE 20 . 29) (T_CONSTANT_ENCAPSED_STRING 29 . 33) (T_CURLY_OPEN 
33 . 34) (T_VARIABLE 34 . 44) ("}" 44 . 45) (T_CONSTANT_ENCAPSED_STRING 45 . 
49) (T_DOLLAR_OPEN_CURLY_BRACES 49 . 51) (T_STRING_VARNAME 51 . 60) ("}" 60 . 
61) (T_CONSTANT_ENCAPSED_STRING 61 . 65) (T_VARIABLE 65 . 75) (T_STRING 75 . 
80) ("]" 80 . 81) (T_CONSTANT_ENCAPSED_STRING 81 . 90) ("`" 90 . 91) (";" 91 . 
92)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php $wpdb->posts; ?>"
    nil
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 12) (T_OBJECT_OPERATOR 
12 . 14) (T_STRING 14 . 19) (";" 19 . 20) (";" 21 . 23) (T_CLOSE_TAG 21 . 
23)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php $var = \"SELECT post_parent FROM $wpdb->posts WHERE ID = 
'\".$id.\"'\"; ?>"
    nil
-   ;; (message "Tokens 1: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens 1: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) ("\"" 
14 . 15) (T_ENCAPSED_AND_WHITESPACE 15 . 39) (T_VARIABLE 39 . 44) 
(T_OBJECT_OPERATOR 44 . 46) (T_STRING 46 . 51) (T_CONSTANT_ENCAPSED_STRING 51 . 
64) ("\"" 64 . 65) ("." 65 . 66) (T_VARIABLE 66 . 69) ("." 69 . 70) 
(T_CONSTANT_ENCAPSED_STRING 70 . 73) (";" 73 . 74) (";" 75 . 77) (T_CLOSE_TAG 
75 . 77)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php $wpdb->get_var(\"SELECT post_parent FROM $wpdb->posts WHERE ID = 
'\".$id.\"'\"); ?>"
    nil
-   ;; (message "Tokens 2: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens 2: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 12) (T_OBJECT_OPERATOR 
12 . 14) (T_STRING 14 . 21) ("(" 21 . 22) ("\"" 22 . 23) 
(T_ENCAPSED_AND_WHITESPACE 23 . 47) (T_VARIABLE 47 . 52) (T_OBJECT_OPERATOR 52 
. 54) (T_STRING 54 . 59) (T_CONSTANT_ENCAPSED_STRING 59 . 72) ("\"" 72 . 73) 
("." 73 . 74) (T_VARIABLE 74 . 77) ("." 77 . 78) (T_CONSTANT_ENCAPSED_STRING 78 
. 81) (")" 81 . 82) (";" 82 . 83) (";" 84 . 86) (T_CLOSE_TAG 84 . 86)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php $this->add($option['style']['selectors'], array('background' => 
\"{$value['color']} url('{$value['image']}')\"));"
    "Complex tokens with tokens inside double-quoted string"
-   ;; (message "Tokens 2: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens 2: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 12) (T_OBJECT_OPERATOR 
12 . 14) (T_STRING 14 . 17) ("(" 17 . 18) (T_VARIABLE 18 . 25) ("[" 25 . 26) 
(T_CONSTANT_ENCAPSED_STRING 26 . 33) ("]" 33 . 34) ("[" 34 . 35) 
(T_CONSTANT_ENCAPSED_STRING 35 . 46) ("]" 46 . 47) ("," 47 . 48) (T_ARRAY 49 . 
54) ("(" 54 . 55) (T_CONSTANT_ENCAPSED_STRING 55 . 67) (T_DOUBLE_ARROW 68 . 70) 
("\"" 71 . 72) (T_ENCAPSED_AND_WHITESPACE 72 . 72) (T_CURLY_OPEN 72 . 73) 
(T_VARIABLE 73 . 79) ("[" 79 . 80) (T_C [...]
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = <<<EOD\nrandom {$value['color']->property} again 
{$value->head()}; random\nEOD;\n"
    "Complex tokens with tokens inside HEREDOC string"
-   ;; (message "Tokens 2: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens 2: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_START_HEREDOC 14 . 21) (T_ENCAPSED_AND_WHITESPACE 21 . 28) (T_CURLY_OPEN 28 
. 29) (T_VARIABLE 29 . 35) ("[" 35 . 36) (T_CONSTANT_ENCAPSED_STRING 36 . 43) 
("]" 43 . 44) (T_OBJECT_OPERATOR 44 . 46) (T_STRING 46 . 54) ("}" 54 . 55) 
(T_ENCAPSED_AND_WHITESPACE 55 . 62) (T_CURLY_OPEN 62 . 63) (T_VARIABLE 63 . 69) 
(T_OBJECT_OPERATOR 69 . 71) (T_STRING 71 . 75) ("(" 75 . 76) (")" 76 . 77) ("}" 
77 . 78) (T_ENCAPSED_AND_WH [...]
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php echo \"\\\"$string\\\"\";"
    "Escaped double quotes with variable in it"
-   ;; (message "Tokens 2: %s" phps-mode-lexer-tokens)
-   (should (equal phps-mode-lexer-tokens
+   ;; (message "Tokens 2: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) ("\"" 12 . 13) 
(T_ENCAPSED_AND_WHITESPACE 13 . 15) (T_VARIABLE 15 . 22) 
(T_CONSTANT_ENCAPSED_STRING 22 . 24) ("\"" 24 . 25) (";" 25 . 26)))))
 
+  (phps-mode-test--with-buffer
+   "<?php $var = \"\\\\\";"
+   "Double quoted string containing only two backslashes"
+   ;; (message "Tokens 2: %s" phps-mode-lex-analyzer--tokens)
+   (should (equal phps-mode-lex-analyzer--tokens
+                  '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_CONSTANT_ENCAPSED_STRING 14 . 18) (";" 18 . 19)))))
+
   )
 
-(defun phps-mode-test-lexer-namespaces ()
+(defun phps-mode-test-lexer--namespaces ()
   "Run test for namespaces."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nnamespace MyNameSpace{\n\tclass MyClass {\n\t\tpublic function 
__construct() {\n\t\t\texit;\n\t\t}\n\t}\n}\n"
    "Object-oriented namespace file"
-   (should (equal phps-mode-lexer-tokens
+   (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_NAMESPACE 7 . 16) (T_STRING 17 . 28) 
("{" 28 . 29) (T_CLASS 31 . 36) (T_STRING 37 . 44) ("{" 45 . 46) (T_PUBLIC 49 . 
55) (T_FUNCTION 56 . 64) (T_STRING 65 . 76) ("(" 76 . 77) (")" 77 . 78) ("{" 79 
. 80) (T_EXIT 84 . 88) (";" 88 . 89) ("}" 92 . 93) ("}" 95 . 96) ("}" 97 . 
98)))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\nNAMESPACE MyNameSpace;\nCLASS MyClass {\n\tpublic function 
__construct() {\n\t\texit;\n\t}\n}\n"
    "Capitalized object-oriented namespace file"
-   (should (equal phps-mode-lexer-tokens
-                  '((T_OPEN_TAG 1 . 7) (T_NAMESPACE 7 . 16) (T_STRING 17 . 28) 
(";" 28 . 29) (T_CLASS 30 . 35) (T_STRING 36 . 43) ("{" 44 . 45) (T_PUBLIC 47 . 
53) (T_FUNCTION 54 . 62) (T_STRING 63 . 74) ("(" 74 . 75) (")" 75 . 76) ("{" 77 
. 78) (T_EXIT 81 . 85) (";" 85 . 86) ("}" 88 . 89) ("}" 90 . 91)))))
+   (should (equal
+            phps-mode-lex-analyzer--tokens
+            '((T_OPEN_TAG 1 . 7) (T_NAMESPACE 7 . 16) (T_STRING 17 . 28) (";" 
28 . 29) (T_CLASS 30 . 35) (T_STRING 36 . 43) ("{" 44 . 45) (T_PUBLIC 47 . 53) 
(T_FUNCTION 54 . 62) (T_STRING 63 . 74) ("(" 74 . 75) (")" 75 . 76) ("{" 77 . 
78) (T_EXIT 81 . 85) (";" 85 . 86) ("}" 88 . 89) ("}" 90 . 91)))))
   )
 
-(defun phps-mode-test-lexer-errors ()
+(defun phps-mode-test-lexer--errors ()
   "Run test for errors."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\necho \"My neverending double quotation\n"
    "Neverending double quotation"
-   (should (equal phps-mode-lexer-tokens
-                  nil)))
+   (should (equal
+            phps-mode-lex-analyzer--tokens
+            nil)))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n`My neverending backquotes\n"
    "Neverending backquotes"
-   (should (equal phps-mode-lexer-tokens
-                  nil)))
+   (should (equal
+            phps-mode-lex-analyzer--tokens
+            nil)))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n<<<LABEL\nMy neverending heredoc\ngoes on forever\n"
    "Neverending heredoc"
-   (should (equal phps-mode-lexer-tokens
-                  nil)))
+   (should (equal
+            phps-mode-lex-analyzer--tokens
+            nil)))
 
   )
 
-(defun phps-mode-test-lexer-get-moved-lexer-tokens ()
+(defun phps-mode-test-lexer--get-moved-lexer-tokens ()
   "Run test for get moved lexer tokens."
 
   (should (equal
            '((T_OPEN_TAG 1 . 7) (T_START_HEREDOC 7 . 21) (T_ERROR 21 . 60))
-           (phps-mode-lexer-get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 8 5)))
+           (phps-mode-lex-analyzer--get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 8 5)))
 
   (should (equal
            '((T_OPEN_TAG 1 . 7) (T_START_HEREDOC 7 . 11) (T_ERROR 11 . 50))
-           (phps-mode-lexer-get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 8 -5)))
+           (phps-mode-lex-analyzer--get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 8 -5)))
 
   (should (equal
            '((T_OPEN_TAG 1 . 8) (T_START_HEREDOC 8 . 17) (T_ERROR 17 . 56))
-           (phps-mode-lexer-get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 6 1)))
+           (phps-mode-lex-analyzer--get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 6 1)))
 
   (should (equal
            '((T_OPEN_TAG 1 . 7) (T_START_HEREDOC 7 . 16) (T_ERROR 16 . 56))
-           (phps-mode-lexer-get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 20 1)))
+           (phps-mode-lex-analyzer--get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 20 1)))
 
   (should (equal
            '((T_OPEN_TAG 1 . 7) (T_START_HEREDOC 7 . 16) (T_ERROR 16 . 54))
-           (phps-mode-lexer-get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 20 -1)))
+           (phps-mode-lex-analyzer--get-moved-tokens '((T_OPEN_TAG 1 . 7) 
(T_START_HEREDOC 7 . 16) (T_ERROR 16 . 55)) 20 -1)))
 
   )
 
-(defun phps-mode-test-lexer-get-moved-lexer-states ()
+(defun phps-mode-test-lexer--get-moved-lexer-states ()
   "Run test for get moved lexer states."
 
   (should (equal
@@ -385,7 +400,7 @@
              (10 67 1 '(1))
              (1 9 1 '(1)))
            
-           (phps-mode-lexer-get-moved-states
+           (phps-mode-lex-analyzer--get-moved-states
             '((66 74 1 '(1))
               (8 65 1 '(1))
               (1 7 1 '(1)))
@@ -397,7 +412,7 @@
              (9 66 1 '(1))
              (2 8 1 '(1)))
            
-           (phps-mode-lexer-get-moved-states
+           (phps-mode-lex-analyzer--get-moved-states
             '((66 74 1 '(1))
               (8 65 1 '(1))
               (1 7 1 '(1)))
@@ -409,7 +424,7 @@
              (8 65 1 '(1))
              (1 7 1 '(1)))
            
-           (phps-mode-lexer-get-moved-states
+           (phps-mode-lex-analyzer--get-moved-states
             '((66 74 1 '(1))
               (8 65 1 '(1))
               (1 7 1 '(1)))
@@ -421,7 +436,7 @@
              (6 63 1 '(1))
              (1 7 1 '(1)))
            
-           (phps-mode-lexer-get-moved-states
+           (phps-mode-lex-analyzer--get-moved-states
             '((66 74 1 '(1))
               (8 65 1 '(1))
               (3 9 1 '(1)))
@@ -429,7 +444,7 @@
             -2)))
   )
 
-(defun phps-mode-test-lexer-benchmark ()
+(defun phps-mode-test-lexer--benchmark ()
   "Benchmark the lexer tests."
   (require 'benchmark)
   (let ((iteration 1)
@@ -439,11 +454,11 @@
            (benchmark-run
                iterations
              (progn
-               (phps-mode-test-lexer-script-boundaries)
-               (phps-mode-test-lexer-simple-tokens)
-               (phps-mode-test-lexer-complex-tokens)
-               (phps-mode-test-lexer-namespaces)
-               (phps-mode-test-lexer-errors)
+               (phps-mode-test-lexer--script-boundaries)
+               (phps-mode-test-lexer--simple-tokens)
+               (phps-mode-test-lexer--complex-tokens)
+               (phps-mode-test-lexer--namespaces)
+               (phps-mode-test-lexer--errors)
                (message "Finished iteration %s" iteration)
                (setq iteration (1+ iteration))))))
       (message "Lexer tests completed in: %ss." elapsed))))
@@ -453,13 +468,13 @@
   ;; (message "-- Running all tests for lexer... --\n")
   ;; (setq debug-on-error t)
   
-  (phps-mode-test-lexer-script-boundaries)
-  (phps-mode-test-lexer-simple-tokens)
-  (phps-mode-test-lexer-complex-tokens)
-  (phps-mode-test-lexer-namespaces)
-  (phps-mode-test-lexer-errors)
-  (phps-mode-test-lexer-get-moved-lexer-tokens)
-  (phps-mode-test-lexer-get-moved-lexer-states)
+  (phps-mode-test-lexer--script-boundaries)
+  (phps-mode-test-lexer--simple-tokens)
+  (phps-mode-test-lexer--complex-tokens)
+  (phps-mode-test-lexer--namespaces)
+  (phps-mode-test-lexer--errors)
+  (phps-mode-test-lexer--get-moved-lexer-tokens)
+  (phps-mode-test-lexer--get-moved-lexer-states)
   ;; (message "\n-- Ran all tests for lexer. --")
 
   )
diff --git a/test/phps-mode-test-syntax-table.el 
b/test/phps-mode-test-syntax-table.el
index d9c9eab..00b3939 100644
--- a/test/phps-mode-test-syntax-table.el
+++ b/test/phps-mode-test-syntax-table.el
@@ -31,10 +31,10 @@
 
 ;; TODO Should test `backward-sexp', `forward-sexp', `backward-word', 
`forward-word', `backward-list', `forward-list' as well
 
-(defun phps-mode-test-syntax-table-quote-region ()
+(defun phps-mode-test-syntax-table--quote-region ()
   "Test double quotes, single quotes, curly bracket, square bracket, round 
bracket, back-quotes on regions."
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = abc;"
    "Double quotes around region"
    (goto-char 14)
@@ -44,7 +44,7 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n$var = \"abc\";"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = abc;"
    "Single-quotes brackets around region"
    (goto-char 14)
@@ -54,7 +54,7 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n$var = 'abc';"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = abc;"
    "Round brackets around region"
    (goto-char 14)
@@ -64,7 +64,7 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n$var = (abc);"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = abc;"
    "Square brackets around region"
    (goto-char 14)
@@ -74,7 +74,7 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n$var = [abc];"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = abc;"
    "Curly brackets around region"
    (goto-char 14)
@@ -84,7 +84,7 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents "<?php\n$var = {abc};"))))
 
-  (phps-mode-test-with-buffer
+  (phps-mode-test--with-buffer
    "<?php\n$var = abc;"
    "Backquotes brackets around region"
    (goto-char 14)
@@ -98,7 +98,7 @@
 
 (defun phps-mode-test-syntax-table ()
   "Run test."
-  (phps-mode-test-syntax-table-quote-region))
+  (phps-mode-test-syntax-table--quote-region))
 
 (phps-mode-test-syntax-table)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]