I’ve been using Atom for just a day or so, and so far I love it… But my main use for it would be for it to support a custom language we use for the Torque3D game engine. To this end, I’ve been trying to write a TorqueScript package all day, and it’s possible but it seems like writing “nice” grammars is near impossible.
Example:
I’d like to be able to highlight code following this pattern:
function ID (PARAMS) { EXPRESSION }
But apart of writing a single big expression to catch it all, I don’t see a nice way of doing it. I’d prefer to be able to re-use my existing RegEx’s instead of having to write the same RegEx’s over and over and change it everywhere if there is a bug
I’ve been trying to do something like:
'functiondeclaration1' :
'patterns': [
{
'begin': '/\\bfunction/i'
'name': 'comment'
'end':
'include': '#functiondeclaration2'
'match': '\\s+'
}
]
'functiondeclaration2' :
'patterns': [
{
'begin': '[a-zA-Z]\\w*'
'name': 'comment'
'end': '\\('
'match': '\\s+'
}
Haven’t been able to make it work yet, but I can’t do an ‘include’ on the ID for the “begin”. Normally, you use grammars like JFlex or similar to implement these sort of things, is that at all possible here?