Extending the yaml language (Ansible)



I'm experimenting with creating an ansible plugin, but I'm a bit stuck on the whole parser and lexer stuff.
In theory Ansible is a subset of yaml, so I thought of extending the YamlLanguage etc, but since most classes are final, I can't really extend from it.

What would be the best course of action to support ansible?

Should I fully create the bnf and jflex files, or can I take some shortcuts? I've seen the post regarding the LanguageSubstitutor, but I don't really see how it could help me.

Ideally I can pick up the tokens provided by yaml, and perhaps in the strings, recognize as a variable.

Thanks in advance!

1 comment

Hi Robin,

Check the language injection mechanism:

Also, I suggest checking if there are plugins that do what you want to implement:

If they are missing the feature you need, I suggest reaching out to authors and contributing to an existing plugin, as creating another plugin for the same technology makes it harder for users to choose one, and joining forces will result in making a single plugin great.


Please sign in to leave a comment.