It depends on how the language author chooses to describe each thing, but there are certain standard classes and they don’t account for every single feature of most languages.
Should I define my own grammar?
Yes. This is pretty easy to do, especially for what you want. I’ve made a grammar boilerplate with annotations and I’ve whipped up a couple of custom language packages for people, so one of those should be easier to parse out than a grammar for an actual language.
You can set up a grammar as a wrapper for Perl that matches your things and then includes the standard Perl grammar.
What you want to do:
- Create the language package. You can use the package generator and delete
lib/ if you want (then you don’t have to touch
package.json). Let’s call it Custom Perl Wrapper.
- Create a
grammars/custom-perl-wrapper.cson file based on the boilerplate. Tell it to match for the Perl extensions and the first line
- Set the scope name to something like
source.perl.custom (the first two parts of that are important, the third can be whatever you like). This page explains scopes in more detail. Set the name to something not Perl.
- Create patterns to match for the specific things you want to change. I would use a class that is not part of the standard class spread, like
.wrapper-regex or something. This will let you easily style individual items from your local stylesheet.
- As the last pattern, simply follow this example with the line
- Reload and check to make sure the grammar is being matched. If it isn’t, you can easily tell Atom to load your custom package instead.