]> gitweb.factorcode.org Git - factor.git/commitdiff
fixup! [misc] vim/syntax: Fixups
authorDusk <me@bb010g.com>
Sun, 7 Jun 2020 02:04:05 +0000 (19:04 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 7 Jun 2020 05:35:13 +0000 (05:35 +0000)
(Thanks, @mrjbq7!) Now:
+ `CHAR:` literals highlight the whole next token.
+ `0b...` binary literals don't require invalid `+=0b` or `-=0b` syntax.
+ Float literals can't start with a `,` separator.
+ Float literals can have exponents with `,` separators.
+ `foo: ...` stack effects function as intended in general.
+ Syntax clusters might be a bit cleaner with `g:factor_syn_no_error`.
+ Error match priority should be cleaned up.

misc/vim/syntax/factor.vim

index e7e014ed41cea638428fd0b0f9f697a85b1a5824..0b325f83eccd74fe1167c1771cd3c037c42e6ef8 100644 (file)
@@ -171,25 +171,26 @@ syn match   factorPosRatio              /\v<\+=[0-9]%([0-9,]*[0-9])?%(\+[0-9]%([
 syn match   factorNegRatio              /\v<\-[0-9]%([0-9,]*[0-9])?%(\-[0-9]%([0-9,]*[0-9]+)?)?\/-=[0-9]%([0-9,]*[0-9]+)?\.?>/
 syn region  factorComplex         start=/\v<C\{>/   end=/\v<\}>/    contains=@factorReal
 syn cluster factorBin                   contains=factorBin
+syn match   factorBin                   /\v<[+-]=0b[01,]+>/
 if !exists('g:factor_syn_no_error')
-  syn match   factorBinError            /\v\<[+-]=0b[01,]*[^01 ]\S*\>/
+  syn match   factorBinError            /\v<[+-]=0b[01,]*[^01 ]\S*>/
   syn cluster factorBin                 add=factorBinError
 endif
-syn match   factorBin                   /\v\<[+-]=0b[01,]\+\>/
 syn cluster factorHexNoRadixTrans       contains=factorHexNoRadixTrans
+syn match   factorHexNoRadixTrans       /\v<[0-9a-fA-F]%([0-9a-fA-F,]*[0-9a-fA-F])?%(\.[0-9a-fA-F]%([0-9a-fA-F,]*[0-9a-fA-F])?)?%(p-=[0-9]%([0-9,]*[0-9])?)?>/ contained transparent
 syn cluster factorHex                   contains=factorHex
+syn match   factorHex                   /\v<[+-]=0x[0-9a-fA-F]%([0-9a-fA-F,]*[0-9a-fA-F])?%(\.[0-9a-fA-F]%([0-9a-fA-F,]*[0-9a-fA-F])?)?%(p-=[0-9]%([0-9,]*[0-9])?)?>/
 if !exists('g:factor_syn_no_error')
   syn match   factorHexNoRadixError     /\v<%(,\S*|\S*,|[-0-9a-fA-Fp,]*[^-0-9a-fA-Fp, ]\S*)>/ contained
   syn cluster factorHexNoRadixTrans     add=factorHexNoRadixError
   syn match   factorHexError            /\v<[+-]=0x%(,\S*|\S*,|[-0-9a-fA-Fp,]*[^-0-9a-fA-Fp, ]\S*)>/
   syn cluster factorHex                 add=factorHexError
 endif
-syn match   factorHexNoRadixTrans       /\v<[0-9a-fA-F]%([0-9a-fA-F,]*[0-9a-fA-F])?%(\.[0-9a-fA-F]%([0-9a-fA-F,]*[0-9a-fA-F])?)?%(p-=[0-9]%([0-9,]*[0-9])?)?>/ contained transparent
-syn match   factorHex                   /\v<[+-]=0x[0-9a-fA-F]%([0-9a-fA-F,]*[0-9a-fA-F])?%(\.[0-9a-fA-F]%([0-9a-fA-F,]*[0-9a-fA-F])?)?%(p-=[0-9]%([0-9,]*[0-9])?)?>/
 syn cluster factorOct                   contains=factorOct
+syn match   factorOct                   /\v<[+-]=0o[0-7,]+>/
 if !exists('g:factor_syn_no_error')
   syn match   factorOctError             /\v<[+-]=0o%(,\S*|\S*,|[0-7,]*[^0-7, ]\S*)>/
-  syn cluster factorOct                 contains=factorOctError
+  syn cluster factorOct                 add=factorOctError
 endif
 syn match   factorOct                   /\v<[+-]=0o[0-7,]+>/
 syn region  factorNan matchgroup=factorNan start=/\v<NAN:>/ matchgroup=NONE end=/\v<\S+>/ contains=@factorComment,@factorHexNoRadixTrans