[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 339be7c 11/28: Finish replacing SGML-based JSX det
From: |
Jackson Ray Hamilton |
Subject: |
[Emacs-diffs] master 339be7c 11/28: Finish replacing SGML-based JSX detection with js-mode’s parsing |
Date: |
Tue, 9 Apr 2019 02:00:13 -0400 (EDT) |
branch: master
commit 339be7c00790fb407cc8449fa8f59baa792cbe69
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Finish replacing SGML-based JSX detection with js-mode’s parsing
This removes the last dependency on sgml-mode for JSX-related logic.
* lisp/progmodes/js.el (js-jsx--start-tag-re)
(js-jsx--end-tag-re): Remove.
(js-jsx--looking-at-start-tag-p)
(js-jsx--looking-back-at-end-tag-p): Reimplement using text
properties, using syntax information which ought to be slightly more
accurate than regexps since it was found by complete parsing.
---
lisp/progmodes/js.el | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index af83e04..df2c413 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -50,7 +50,6 @@
(require 'imenu)
(require 'moz nil t)
(require 'json)
-(require 'sgml-mode)
(require 'prog-mode)
(eval-when-compile
@@ -2211,13 +2210,10 @@ testing for syntax only valid as JSX."
(js--regexp-opt-symbol '("in" "instanceof")))
"Regexp matching operators that affect indentation of continued
expressions.")
-(defconst js-jsx--start-tag-re
- (concat "<" sgml-name-re)
- "Regexp matching code that looks like a JSXOpeningElement.")
-
(defun js-jsx--looking-at-start-tag-p ()
"Non-nil if a JSXOpeningElement immediately follows point."
- (looking-at js-jsx--start-tag-re))
+ (let ((tag-beg (get-text-property (point) 'js-jsx-tag-beg)))
+ (and tag-beg (memq (car tag-beg) '(open self-closing)))))
(defun js--looking-at-operator-p ()
"Return non-nil if point is on a JavaScript operator, other than a comma."
@@ -2263,13 +2259,9 @@ testing for syntax only valid as JSX."
(setq result nil)))
result))
-(defconst js-jsx--end-tag-re
- (concat "</" sgml-name-re ">\\|/>")
- "Regexp matching a JSXClosingElement.")
-
(defun js-jsx--looking-back-at-end-tag-p ()
"Non-nil if a JSXClosingElement immediately precedes point."
- (looking-back js-jsx--end-tag-re (point-at-bol)))
+ (get-text-property (point) 'js-jsx-tag-end))
(defun js--continued-expression-p ()
"Return non-nil if the current line continues an expression."
- [Emacs-diffs] master updated (e1872f8 -> cf416d9), Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 27e9bce 03/28: Add new (failing) unclosed JSX test and separate such tests, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 2bedd23 09/28: Update expectations for JSX indentation in JSXAttribute space, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 16669d7 16/28: Fix counting of nested self-closing JSXOpeningElements, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 52a3113 06/28: Add basic JSX font-locking, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 339be7c 11/28: Finish replacing SGML-based JSX detection with js-mode’s parsing,
Jackson Ray Hamilton <=
- [Emacs-diffs] master 8dae742 08/28: Propertize and font-lock JSXText and JSXExpressionContainers, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 3eadf1e 24/28: Identify JSX strings (for js2-mode), Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 4b305bb 02/28: Refactor JSX indentation code to improve enclosing JSX discovery, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 58c77f1 01/28: Add failing tests for JSX indentation bugs, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 4d2b5bb 07/28: Font-lock JSX while editing it by extending regions, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 462baab 19/28: Add tests for miscellaneous JSX parsing feats, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master be86ece 04/28: js-syntax-propertize: Disambiguate JS from JSX, fixing some indents, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master d9d1bb2 14/28: Rename tests to use the “.jsx” file extension, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 84b1cfb 15/28: Indent broken arrow function bodies as an N+1th arg, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 6f53576 05/28: Use js-jsx- prefix for functions and variables, Jackson Ray Hamilton, 2019/04/09