In PDP11/40 assembling language a number ends with dot is interpreted as a decimal number.
I use the following pattern but fail to match that notation, for example, 8.
:
syn match asmpdp11DecNumber /\<[0-9]\+\.\>/
When I replace \.
with D
the pattern can match 8D
without any problem. Could anyone tell me what is wrong with my "end-with-dot" pattern? Thanks.
Your regular expression syntax is fine (well, you can use \d
instead of [0-9]
), but your 'iskeyword'
value does not include the period .
, so you cannot match the end-of-word (\>
) after it.
It looks like you're writing a syntax for a custom filetype. One option is to
:setlocal filetype+=.
in a corresponding ~/.vim/ftplugin/asmpdp11.vim
filetype plugin. Do this when the period character is considered a keyword character in your syntax.
Otherwise, drop the \>
to make the regular expression match. If you want to ensure that there's no non-whitespace character after the period, you can assert that condition after the match, e.g. like this:
:syn match asmpdp11DecNumber /\<\d\+\.\S\@!/