branch: externals/rec-mode
commit 3e2f5a77ad88a1c0a0a0c92d487859d4b787b48a
Author: Jose E. Marchesi <[email protected]>
Commit: Antoine Kalmbach <[email protected]>
rec-mode: support for multiple field names in %type entries.
---
etc/rec-mode.el | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/etc/rec-mode.el b/etc/rec-mode.el
index bbf459a..f975c93 100644
--- a/etc/rec-mode.el
+++ b/etc/rec-mode.el
@@ -1182,11 +1182,17 @@ returned."
(with-temp-buffer
(insert type-descr)
(goto-char (point-min))
- (when (looking-at "[ \n\t]*\\([a-zA-Z%][a-zA-Z0-9_-]*\\)[ \n\t]*")
- (let ((name (match-string 1)))
- (goto-char (match-end 0))
- (when (equal name field-name)
- (setq res-type (rec-parse-type (buffer-substring (point)
(point-max)))))))))
+ (when (looking-at "[
\n\t]*\\([a-zA-Z%][a-zA-Z0-9_-]*\\(,[a-zA-Z%][a-zA-Z0-9_-]*\\)?\\)[ \n\t]*")
+ (let ((names (match-string 1))
+ (begin-description (match-end 0))
+ name)
+ (goto-char (match-beginning 1))
+ (while (looking-at "\\([a-zA-Z%][a-zA-Z0-9_-]*\\),?")
+ (if (equal (match-string 1) field-name)
+ (progn
+ (goto-char begin-description)
+ (setq res-type (rec-parse-type (buffer-substring (point)
(point-max)))))
+ (goto-char (match-end 0))))))))
types)
res-type))