[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/parseclj 879ac980a8 056/185: Treat numbers with trailing s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/parseclj 879ac980a8 056/185: Treat numbers with trailing symbol characters as lex errors |
Date: |
Tue, 28 Dec 2021 14:05:16 -0500 (EST) |
branch: elpa/parseclj
commit 879ac980a83468cebc87102e2e2ab85e0fcf4679
Author: Arne Brasseur <arne@arnebrasseur.net>
Commit: Arne Brasseur <arne@arnebrasseur.net>
Treat numbers with trailing symbol characters as lex errors
---
clj-lex-test.el | 12 ++++++++++++
clj-lex.el | 17 ++++++++++++++---
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/clj-lex-test.el b/clj-lex-test.el
index 30d1082625..44553571a4 100644
--- a/clj-lex-test.el
+++ b/clj-lex-test.el
@@ -38,6 +38,18 @@
(form . "123")
(pos . 1)))))
+ (with-temp-buffer
+ (insert "123e34M")
+ (goto-char 1)
+ (should (equal (clj-lex-next) '((type . :number)
+ (form . "123e34M")
+ (pos . 1)))))
+
+ (with-temp-buffer
+ (insert "123x")
+ (goto-char 1)
+ (should (equal (clj-lex-next) (clj-lex-token :lex-error "123x" 1
'error-type :invalid-number-format))))
+
(with-temp-buffer
(insert " \t \n")
(goto-char 1)
diff --git a/clj-lex.el b/clj-lex.el
index c5570331a6..e0bdb6d21f 100644
--- a/clj-lex.el
+++ b/clj-lex.el
@@ -91,9 +91,20 @@
(when (eq (char-after (point)) ?M)
(right-char))
- (clj-lex-token :number
- (buffer-substring-no-properties pos (point))
- pos)))
+ (let ((char (char-after (point))))
+ (if (and char (or (and (<= ?a char) (<= char ?z))
+ (and (<= ?A char) (<= char ?Z))
+ (and (member char '(?. ?* ?+ ?! ?- ?_ ?? ?$ ?& ?= ?<
?> ?/)))))
+ (progn
+ (right-char)
+ (clj-lex-token :lex-error
+ (buffer-substring-no-properties pos (point))
+ pos
+ 'error-type :invalid-number-format))
+
+ (clj-lex-token :number
+ (buffer-substring-no-properties pos (point))
+ pos)))))
(defun clj-lex-digit? (char)
- [nongnu] elpa/parseclj d659079598 174/185: Remove the remaining a.el dependency from non-test code, (continued)
- [nongnu] elpa/parseclj d659079598 174/185: Remove the remaining a.el dependency from non-test code, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 507720a632 170/185: Release 1.0, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 6d1c9c348a 184/185: Update CHANGELOG, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 61513d2c99 164/185: Merge pull request #27 from clojure-emacs/shebang-and-symbolic-values, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj e6bce85062 159/185: Update the CHANGELOG, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 1f7fe675ae 172/185: Merge pull request #31 from clojure-emacs/remove-a-el-part-2, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj a8c4cf30fb 185/185: Correctly bump versions, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 7ae887b1de 037/185: Refactor clj-parse.el, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj a83816010e 039/185: Refactor clj-parse-test., ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 9d4c0b7b4b 041/185: Merge pull request #2 from volrath/tag-support, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 879ac980a8 056/185: Treat numbers with trailing symbol characters as lex errors,
ELPA Syncer <=
- [nongnu] elpa/parseclj 2781f0cd7f 088/185: Vocab chage: closer/opener => closing-token/opening-token, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 4fc37462ab 073/185: Make Travis use Cask, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj a71e57df4d 080/185: Rename clj-lex to parseclj-lex, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 168027fed5 094/185: Merge pull request #7 from lambdaisland/reorganize-package, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 45bd6a7431 109/185: Clean up tests, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 1f8e449897 105/185: Simplify error messages, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj f362018ff1 112/185: Silence the byte-compiler about some unused vars., ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 70804992ee 122/185: Merge pull request #14 from lambdaisland/parseclj-lex-symbol-fix, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 19ca5f5bd0 121/185: Stick to the previous Travis Trusty image, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj b2550e6456 133/185: Add docstring for `parseclj-lex--string-value`, ELPA Syncer, 2021/12/28