2014-01-08 11:25:05 +00:00
( require 'generic-x )
( define-abbrev-table 'lean-mode-abbrev-table ' (
;; math/unicode symbols
( " forall " " ∀ " )
( " exists " " ∃ " )
( " fun " " λ " )
2014-01-08 11:33:09 +00:00
( " imp " " → " )
( " and " " ∧ " )
( " or " " ∨ " )
2014-01-08 11:25:05 +00:00
( " not " " ¬ " )
2014-01-08 11:33:09 +00:00
( " neq " " ≠ " )
( " geq " " ≥ " )
( " leq " " ≤ " )
2014-01-08 11:25:05 +00:00
( " Nat " " ℕ " )
( " Int " " ℤ " )
2014-01-08 11:36:55 +00:00
( " var " " variable " )
( " vars " " variables " )
( " def " " definition " )
( " th " " theorem " )
2014-01-08 11:25:05 +00:00
) )
( define-generic-mode
'lean-mode ;; name of the mode to create
' ( " -- " ) ;; comments start with
2014-01-09 16:33:52 +00:00
' ( " import " " definition " " variable " " variables " " print " " axiom " " theorem " " universe " " alias " " help " " set_option " " set_opaque " " environment " " options " " infix " " infixl " " infixr " " notation " " eval " " check " " exit " " coercion " " end " " using " " namespace " " builtin " " scope " " pop_scope " ) ;; some keywords
2014-01-08 11:25:05 +00:00
' ( ( " \\ < \\ (Bool \\ |Int \\ |Nat \\ |Real \\ |Type \\ |TypeU \\ |ℕ \\ |ℤ \\ ) \\ > " . 'font-lock-type-face )
( " \\ < \\ (calc \\ |have \\ |in \\ |let \\ ) \\ > " . font-lock-keyword-face )
( " \" [^ \" ]* \" " . 'font-lock-string-face )
( " \\ (-> \\ |/ \\ \\ \\ |== \\ | \\ \\ / \\ |[*+/:<=>¬λ→∀∃∧∨≠≤≥-] \\ ) " . 'font-lock-constant-face ) )
' ( " \\ .lean$ " ) ;; files for which to activate this mode
' ( ( lambda ( )
( setq local-abbrev-table lean-mode-abbrev-table )
( abbrev-mode 1 ) ) )
" A mode for Lean files " ;; doc string for this mode
)
; (regexp-opt '("Int" "Bool" "Nat" "Type" "Real") t)
; (regexp-opt '("let" "in" "have" "calc" "forall" "exists") t)
; (regexp-opt '("=" "->" "≠" "∨ " "∧" "¬" "/\\" "\\/" "+" "-" "*" "/" "<" ">" "≤" "≥" "==" "∀" "∃" "→" "λ" ":") t)