Thursday, July 12, 2018

Re: Syntax matching question(s)

On Thursday, July 12, 2018 at 10:51:40 PM UTC-4, Robert wrote:
> I am creating a vim syntax file for GNU Rec as an exercise in creating a new syntax file.
>
> The things that I need colored are:
>
> %word:
> +
> word:
> # comment
>
> I have the following so far:
>
>
> " /^%\w+:\s/gm
> syntax match recDesc "\v^%\w+:\s"
>
> " recField
> " /^\w+:\s/g,
> syntax match recField "\v^\w+:\s"
>
> " /^\+\s/gm
> syntax match recPlus "^+\s"
>
> " /^#.*/gm
> syntax match recComment "^#.*"
>
> The first "recDesc" is not working but the other three (3) are. I was wondering why that is so? I am thinking recDesc and recField are too close in matching.
>
> Also, is there a better regex for the matches?
>
> Thanks for any help and suggestions.
>
> --
> Bob

Had a late work night so did this:

syntax match recField "\v^\w+:\s"
syntax match recPlus "^+\s"
syntax match recComment "^#.*"

syntax region recDesc start="^%" end=":" contains=recField

Everything works. Are those "optimal"?

--
Bob

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: