branch: externals/a68-mode
commit 4fcb92ee43ab536003156c406ec907396cc65253
Author: Omar Polo <o...@omarpolo.com>
Commit: Omar Polo <o...@omarpolo.com>

    correctly highlight comments
    
    Algol68 support three styles of comments:
    
        1) COMMENT ... COMMENT
        2) CO ... CO
        3) # ... #
    
    These can't be nested, although you can have things like
    
            COMMENT CO ... CO COMMENT
    
    as a whole comment because from `COMMENT' up to the next closer
    `COMMENT' is a single comment (duh.)
---
 a68-mode.el | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/a68-mode.el b/a68-mode.el
index 9ddd2e3f8a..496f4a59b5 100644
--- a/a68-mode.el
+++ b/a68-mode.el
@@ -219,7 +219,23 @@
   (setq-local font-lock-defaults '(a68-font-lock-keywords))
   (setq-local indent-line-function #'a68-indent-line)
   (setq-local comment-start "#")
-  (setq-local comment-end "#"))
+  (setq-local comment-end "#")
+  (setq-local syntax-propertize-function
+              (syntax-propertize-rules ((rx (group bow "COMMENT" eow)
+                                            (group (*? anychar))
+                                            (group bow "COMMENT" eow))
+                                        (1 "<")
+                                        (3 ">"))
+                                       ((rx (group bow "CO" eow)
+                                            (group (*? anychar))
+                                            (group bow "CO" eow))
+                                        (1 "<")
+                                        (3 ">"))
+                                       ((rx (group "#")
+                                            (group (*? anychar))
+                                            (group "#"))
+                                        (1 "<")
+                                        (3 ">")))))
 
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.a68\\'" . a68-mode))

Reply via email to