aboutsummaryrefslogtreecommitdiff
path: root/lux-mode
diff options
context:
space:
mode:
authorThe Lux Programming Language2018-07-28 15:52:36 -0400
committerGitHub2018-07-28 15:52:36 -0400
commit072849be197dc6bb6007d08bb26be00cc374c744 (patch)
tree522a5ef5077eb4cf10e083a9feec042476626f7b /lux-mode
parentb14102eaa2a80f51f160ba293ec01928dbe683c3 (diff)
parent168d36d07b48d2d936de24aa69b8464e68992075 (diff)
Merge pull request #46 from LuxLang/change-number-signs
Change number signs
Diffstat (limited to 'lux-mode')
-rw-r--r--lux-mode/lux-mode.el27
1 files changed, 17 insertions, 10 deletions
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el
index 7d717d5b2..3b97d4718 100644
--- a/lux-mode/lux-mode.el
+++ b/lux-mode/lux-mode.el
@@ -211,23 +211,30 @@ Called by `imenu--generic-function'."
(defun altRE (&rest alternatives)
(concat "\\(" (mapconcat 'identity alternatives "\\|") "\\)"))
+(defun literal (content)
+ (concat "\\<" content "\\>"))
+
+(defun special (normal)
+ (concat "#" normal))
+
(defconst lux-font-lock-keywords
- (let ((digits "[0-9][0-9_]*")
- (digits+ "[0-9_]+")
+ (let ((natural "[0-9][0-9_]*")
(identifier_h "[a-zA-Z-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]")
- (identifier_t "[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]"))
- (let ((identifier (concat identifier_h identifier_t "*")))
- (let ((bitRE (concat "\\<" (regexp-opt '("#0" "#1") t) "\\>"))
- (natRE (concat "\\<\\+" digits "\\>"))
- (int&fracRE (concat "\\<-?" digits "\\(\\." digits+ "\\(\\(e\\|E\\)\\(-\\|\\+\\)?" digits "\\)?\\)?\\>"))
- (frac-ratioRE (concat "\\<-?" digits "/" digits "\\>"))
- (revRE (concat "\\<\\." digits "\\>"))
+ (identifier_t "[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]")
+ (sign (altRE "-" "\\+")))
+ (let ((identifier (concat identifier_h identifier_t "*"))
+ (integer (concat sign natural)))
+ (let ((bitRE (literal (special (altRE "0" "1"))))
+ (natRE (literal natural))
+ (int&fracRE (literal (concat integer "\\(\\." natural "\\(\\(e\\|E\\)" integer "\\)?\\)?")))
+ (frac-ratioRE (literal (concat integer "/" natural)))
+ (revRE (literal (concat "\\." natural)))
(tagRE (let ((separator "\\."))
(let ((in-prelude separator)
(in-current-module (concat separator separator))
(in-module (concat identifier separator))
(in-local ""))
- (concat "#" (altRE in-prelude in-current-module in-module in-local) identifier)))))
+ (special (concat (altRE in-prelude in-current-module in-module in-local) identifier))))))
(eval-when-compile
`(;; Special forms
(,(let (;; Control