Well, the YAML is just a slightly different format (and less cumbersome) than the TextMate XML file. The basic lexical searching is the same; same context and scope stacks and that sort of thing. I don’t know about Notepad++ but we’re not just coloring keywords here, we’re actually putting in lexical structure in the background that (theoretically) can be leveraged to do other neat things.
Just sort of depends on what neat things you want to do I guess.
You could do just a keyword coloration in probably about 15 minutes or less because it’s quite easy to put in a list of those and just have it scope them as keyword.other.ada and bam, you’re done. And maybe that’s enough!
As for scoping, it’s not really a matter of speed or number of scopes, just I was going by the Scope Naming best practices in Sublime’s documentation. When you get way down in a structure, there are a lot of layered scopes.
So, just as a for instance, given this VHDL code (which should look a lot like Ada)
entity foobar is
end entity foobar;
architecture rtl of foobar is
begin
MY_PROCESS : process (clk, reset)
begin
if (reset = '1') then
a <= b;
c <= d;
elsif rising_edge(clk) then
if (ce = '1') then
e <= f;
end if;
end if;
end process MY_PROCESS;
end architecture rtl;
If I put the cursor down at the e <= f;
line I have the following scope:
vhdl-mode: source.vhdl meta.block.architecture.body.vhdl meta.block.process.body.vhdl meta.block.if.body.vhdl meta.block.if.body.vhdl meta.statement.assignment.signal.vhdl keyword.operator.assignment.vhdl
That’s pretty fine grained, and that’s what I wanted to have. I think the nesting scope naming rules are to keep a single lexical structure from generating too many scopes. Where you see meta.block.architecture.body.vhdl
honestly I could have probably gone with meta.block.architecture.vhdl meta.group.architecture.body.vhdl
and subscoped the architecture
structure. Same with process
there because it too has a declaration portion and a body portion (even though this example didn’t use it. The relevant documentation that explains this is in the scope naming document (https://www.sublimetext.com/docs/3/scope_naming.html)
The entire scope of a function should be covered by one of the following scopes. Each variant should be applied to a specific part, and not stacked. For example, meta.function.php meta.function.parameters.php
should never occur, but instead the scopes should alternate between meta.function.php
then meta.function.parameters.php
and back to meta.function.php
.
I took this to read that I shouldn’t layer like I said. However, there is an issue with expand selection to scope where it starts popping scopes off the stack for selection and doing that, it’ll never get the entire meta.block
though I think Thom has a fix for that.
Hope that helps! I do think you can do quite a lot with the syntax and it’s possible to make it simple, or really elaborate, as you will.
For what it’s worth, I do have an Ada book here. I don’t use it, but I have it mainly because it tickled me to have it because it was the starting baseline for VHDL. However point being, I can probably help out a bit if you still want to take on the syntax file task.