unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [ELPA] New package: phps-mode
@ 2019-07-12 17:15 Christian Johansson
  2019-07-12 22:35 ` Stephen Leake
  2019-07-12 23:36 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 11+ messages in thread
From: Christian Johansson @ 2019-07-12 17:15 UTC (permalink / raw)
  To: emacs-devel

Hi!

My name is Christian Johansson, I have done the FSF paperwork and want 
to get my package phps-mode into ELPA for GNU Emacs, I have a repo here: 
https://github.com/cjohansson/emacs-phps-mode

Package summary:

The phps-mode plug-in for Emacs provides a new major-mode for PHP that 
is not based on CC-mode. It has a built-in semantic lexer that should be 
equivalent to the original PHP re2c lexer, supports PSR-1 and PSR-2 
coding styles and uses lexer tokens for syntax coloring, imenu and 
indentation. In the future the goals are to provide a semantic parser, 
eldoc, html/css/javascript indentation for inlines areas


Regards
Christian





^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [ELPA] New package: phps-mode
@ 2019-07-16 10:00 Mattias Engdegård
  2019-07-17  5:43 ` Christian Johansson
  0 siblings, 1 reply; 11+ messages in thread
From: Mattias Engdegård @ 2019-07-16 10:00 UTC (permalink / raw)
  To: christian; +Cc: Emacs developers

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.




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-07-17 20:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-12 17:15 [ELPA] New package: phps-mode Christian Johansson
2019-07-12 22:35 ` Stephen Leake
2019-07-12 23:36 ` Lars Ingebrigtsen
2019-07-13 13:14   ` Stefan Monnier
2019-07-13 13:28     ` Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2019-07-16 10:00 Mattias Engdegård
2019-07-17  5:43 ` Christian Johansson
2019-07-17  8:44   ` Mattias Engdegård
2019-07-17  9:36     ` Christian Johansson
2019-07-17 12:24       ` Stefan Monnier
2019-07-17 20:27     ` Christian Johansson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).