emacs-devel
[Top][All Lists]
Advanced

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

Re: [ELPA] New package: phps-mode


From: Mattias Engdegård
Subject: Re: [ELPA] New package: phps-mode
Date: Tue, 16 Jul 2019 12:00:27 +0200

Thank you for your contribution! A regexp scan on phps-mode, using relint, 
found some irregularities. Summary here, along with some things that relint 
didn't catch:

php-mode-lexer.el:160:
(defvar phps-mode-lexer-TOKENS "[][;\\:,\.()|^&+-/*=%!~\\$<>?@]"

The hyphen (-) is special and should be placed last to avoid being interpreted 
as a range.

The lone backslash in front of the dot has no effect, since backslashes must be 
doubled inside string literals.
On the regexp level, backslashes are not special inside [...] and only 
represent themselves, with no escaping power. This regexp includes it multiple 
times which was probably unintended.

php-mode-lexer.el:1367:
                   (if (looking-at "[^\\\\]\"")

No need to double the backslash; it's not special inside [...].

php-mode-lexer.el:151:
  "[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*"

Hex and octal escapes in the 128-255 range do not denote Unicode (Latin-1) 
characters but raw bytes, which you likely did not intend to match here. To 
match U+0080-U+00FF, write "\u0080-\u00FF". I don't know PHP's lexing rules, 
but if you want to match Unicode identifiers, you'd be better off using 
something like "[[:alpha:]_][[:alnum:]_]*", or syntax classes.

php-mode-functions.el:990:
            (when (looking-at-p " \\*\/")

Ineffective backslash before `/', which does not need escaping anyway.
The same pattern (`\/') occurs in several other places in this file.




reply via email to

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