]> gitweb.factorcode.org Git - factor.git/commitdiff
misc/vim: Add EBNF: and EDITOR:
authorGiftpflanze <gifti@tools.wmflabs.org>
Mon, 22 May 2023 22:48:44 +0000 (00:48 +0200)
committerGiftpflanze <gifti@tools.wmflabs.org>
Mon, 22 May 2023 22:48:44 +0000 (00:48 +0200)
Add syntax highlighting for EBNF: and EDITOR:
Fix indenting for EDITOR:

Fixes #2737

misc/vim/indent/factor.vim
misc/vim/syntax/factor.vim

index f4a6f66ff2ca2d0a2c32e49e3e131d51f4288d31..5ec8673ff94fdb0538176431108b40c94f307e9c 100644 (file)
@@ -23,7 +23,7 @@ function! GetFactorIndent(lnum)
        if pline =~ '^[^ ]*:' || pline =~ '[{[]\s*$'
                let pind += shiftwidth()
        endif
-       if pline =~ '^\(ALIAS\|C\|CONSTANT\|DEFER\|FORGET\|GENERIC#\?\|HELP\|\(\(SHUTDOWN\|STARTUP\)-\)\?HOOK\|IN\|INSTANCE\|MAIN\|MATH\|MIXIN\|PRIMITIVE\|QUALIFIED\(-WITH\)\?\|RENAME\|SINGLETON\|SLOT\|SYMBOL\|USE\|USING\):'
+       if pline =~ '^\(ALIAS\|C\|CONSTANT\|DEFER\|EDITOR\|FORGET\|GENERIC#\?\|HELP\|\(\(SHUTDOWN\|STARTUP\)-\)\?HOOK\|IN\|INSTANCE\|MAIN\|MATH\|MIXIN\|PRIMITIVE\|QUALIFIED\(-WITH\)\?\|RENAME\|SINGLETON\|SLOT\|SYMBOL\|USE\|USING\):'
                let pind -= shiftwidth()
        endif
        if pline =~ ';\( \(inline\|recursive\|foldable\|flushable\)\)*$'
index da6121d2a681e70b0c13d07e596c58f1c0ce9e63..3f14bbbc9dc162a513cbbc5b796bc3ac41e2b453 100644 (file)
@@ -170,7 +170,7 @@ syn region  factorNamedString       matchgroup=factorNamedStringDelims   start=/
 syn region  factorMultilineComment  start=/\v<\/\*>/              end=/\v\*\//       contains=@factorCommentContents keepend
 syn region  factorMultilineComment  start=/\v<!\[\z(\=*)\[/       end=/\v\]\z1\]/    contains=@factorCommentContents keepend
 
-syn region factorRegexp             start=/\v<%(R\/\s)/  skip=/\v%(\\\/)/  end=/\v%(\/\S*)>/
+syn region  factorRegexp            start=/\v<%(R\/\s)/  skip=/\v%(\\\/)/  end=/\v%(\/\S*)>/
 
 syn cluster factorReal              contains=@factorInteger,@factorFloat,@factorRatio,@factorBin,@factorOct,@factorHex,factorNan
 syn cluster factorNumber            contains=@factorReal,factorComplex
@@ -258,6 +258,8 @@ syn region  factorAlias             start=/\v<ALIAS:>/           skip=/\v<!>.*/
 syn region  factorAlien             start=/\v<ALIEN:>/           skip=/\v<!>.*/     end=/\v<\S+>/   contains=@factorComment,@factorHexNoRadix
 syn region  factorConstant          start=/\v<CONSTANT:>/        skip=/\v<!>.*/     end=/\v<\S+>/   contains=@factorComment
 syn region  factorDefer             start=/\v<DEFER:>/           skip=/\v<!>.*/     end=/\v<\S+>/   contains=@factorComment
+syn region  factorEbnf              start=/\v<EBNF:>/            skip=/\v<!>.*/     end=/\v<\S+>/   contains=@factorComment
+syn region  factorEditor            start=/\v<EDITOR:>/          skip=/\v<!>.*/     end=/\v<\S+>/   contains=@factorComment
 syn region  factorExclude           start=/\v<EXCLUDE:>/         skip=/\v<!>.*/     end=/\v<;>/     contains=@factorComment
 syn region  factorForget            start=/\v<FORGET:>/          skip=/\v<!>.*/     end=/\v<\S+>/   contains=@factorComment
 syn region  factorFrom              start=/\v<FROM:>/            skip=/\v<!>.*/     end=/\v<;>/     contains=@factorComment
@@ -441,6 +443,8 @@ if !exists('g:factor_syn_no_init')
   HiLink   factorPostpone               Define
   HiLink   factorHelp                   Define
   HiLink   factorDefer                  Define
+  HiLink   factorEbnf                   Typedef
+  HiLink   factorEditor                 Typedef
   HiLink   factorForget                 Define
   HiLink   factorAlien                  Define
   HiLink   factorSlot                   Define
@@ -501,4 +505,4 @@ delcommand HiLink
 
 let b:current_syntax = 'factor'
 
-" vim: set ft=vim et sw=2 isk+=/,\\ :
+" vim: set ts=4 ft=vim et sw=2 isk+=/,\\ :