editors

changeset 25:98adddd1b1c8

Highlight various numeric values. Also added a missing keyword, until.
author Jeremy Cowgar <jeremy@cowgar.com>
date Sat Nov 06 19:48:17 2010 +0000 (2010-11-06)
parents 0aa646c98e4d
children d20abca87f49
files emacs/euphoria-mode.el
line diff
     1.1 --- a/emacs/euphoria-mode.el	Sat Nov 06 18:33:53 2010 +0000
     1.2 +++ b/emacs/euphoria-mode.el	Sat Nov 06 19:48:17 2010 +0000
     1.3 @@ -46,8 +46,9 @@
     1.4  ;; (regexp-opt '("as" "and" "break" "by" "case" "constant" "continue"
     1.5  ;;   "do" "end" "else" "elsif" "elsedef" "elsifdef" "exit" "entry" "enum"
     1.6  ;;   "export" "for" "function" "global" "goto" "include" "if" "ifdef"
     1.7 -;;   "label" "loop" "namespace" "not" "or" "procedure" "public" "return" "retry"
     1.8 -;;   "switch" "then" "type" "to" "while" "with" "without" "xor"))
     1.9 +;;   "label" "loop" "namespace" "not" "or" "override" "procedure" "public"
    1.10 +;;   "return" "retry" "switch" "then" "type" "to" "until" "while" "with" "without"
    1.11 +;;   "xor"))
    1.12  ;;
    1.13  ;; Types:
    1.14  ;;
    1.15 @@ -56,13 +57,22 @@
    1.16  
    1.17  (defconst euphoria-font-lock-keywords-1
    1.18    (list
    1.19 -   '("\\<[+-]?[0-9_\\.]+\\>" . font-lock-constant-face)
    1.20 +   '("\\<[+-\.]?\\(0d\\)?[0-9_\\.]+\\>" . font-lock-constant-face)
    1.21 +   '("\\<0b[0-1_]+\\>" . font-lock-constant-face)
    1.22 +   '("\\<0t[0-8_]+\\>" . font-lock-constant-face)
    1.23 +   '("\\<0x[0-9A-Fa-f_]+\\>" . font-lock-constant-face)
    1.24     '("\\<[A-Z0-9][^ \t\n\r]*\\>" . font-lock-constant-face)
    1.25     '("\\<\\(atom\\|integer\\|object\\|sequence\\)\\>" . font-lock-type-face)
    1.26 -   '("\\<\\(a\\(?:nd\\|s\\)\\|b\\(?:reak\\|y\\)\\|c\\(?:ase\\|on\\(?:stant\\|tinue\\)\\)\\|do\\|e\\(?:ls\\(?:e\\(?:def\\)?\\|if\\(?:def\\)?\\)\\|n\\(?:d\\|try\\|um\\)\\|x\\(?:\\(?:i\\|por\\)t\\)\\)\\|f\\(?:or\\|unction\\)\\|g\\(?:lobal\\|oto\\)\\|i\\(?:f\\(?:def\\)?\\|nclude\\)\\|l\\(?:abel\\|oop\\)\\|n\\(?:amespace\\|ot\\)\\|or\\|p\\(?:rocedure\\|ublic\\)\\|ret\\(?:ry\\|urn\\)\\|switch\\|t\\(?:hen\\|o\\|ype\\)\\|w\\(?:hile\\|ith\\(?:out\\)?\\)\\|xor\\)\\>" . font-lock-builtin-face)
    1.27 +   '("\\<\\(a\\(?:nd\\|s\\)\\|b\\(?:reak\\|y\\)\\|c\\(?:ase\\|on\\(?:stant\\|tinue\\)\\)\\|do\\|e\\(?:ls\\(?:e\\(?:def\\)?\\|if\\(?:def\\)?\\)\\|n\\(?:d\\|try\\|um\\)\\|x\\(?:\\(?:i\\|por\\)t\\)\\)\\|f\\(?:or\\|unction\\)\\|g\\(?:lobal\\|oto\\)\\|i\\(?:f\\(?:def\\)?\\|nclude\\)\\|l\\(?:abel\\|oop\\)\\|n\\(?:amespace\\|ot\\)\\|o\\(?:r\\|verride\\)\\|p\\(?:rocedure\\|ublic\\)\\|ret\\(?:ry\\|urn\\)\\|switch\\|t\\(?:hen\\|o\\|ype\\)\\|until\\|w\\(?:hile\\|ith\\(?:out\\)?\\)\\|xor\\)\\>" . font-lock-builtin-face)
    1.28 +
    1.29     )
    1.30    "Minimal highlighting for Euphoria mode.")
    1.31  
    1.32 +(defconst euphoria-imenu-generic-expression
    1.33 +  '(("Routine" "^\\(export\\|public\\|global\\|override\\)?[ \t]*\\(function\\|procedure\\)[ \t]+\\([a-z]+\\)" 3)
    1.34 +    )
    1.35 +  "Generic Imenu setup")
    1.36 +
    1.37  (defvar euphoria-font-lock-keywords euphoria-font-lock-keywords-1)
    1.38  
    1.39  (defvar euphoria-mode-syntax-table nil)
    1.40 @@ -73,6 +83,9 @@
    1.41        ;; _ is part of a word
    1.42        (modify-syntax-entry ?_ "w" euphoria-mode-syntax-table)
    1.43  
    1.44 +      ;; define '...' strings
    1.45 +      (modify-syntax-entry ?\' "\""   euphoria-mode-syntax-table)
    1.46 +
    1.47        ;; define `...` strings
    1.48        (modify-syntax-entry ?\` "\""   euphoria-mode-syntax-table)
    1.49  
    1.50 @@ -94,6 +107,7 @@
    1.51         '(euphoria-font-lock-keywords))
    1.52    (make-local-variable 'comment-start)
    1.53    (setq comment-start "-- ")
    1.54 +  (setq imenu-generic-expression euphoria-imenu-generic-expression)
    1.55    (setq major-mode 'euphoria-mode)
    1.56    (setq mode-name "Euphoria")
    1.57    (run-hooks 'euphoria-mode-hook))

SCM Home | OpenEuphoria.org Home