Exporting an Existing Language Defintion?
-
Hi all,
Is it possible to export an existing language definition so that a new UDL can be based on it? What I’m hoping to do is export the Python language definition so I can modify it to create one for GDScript.Of course, if someone knows of a GDScript UDL that already exists, that would do just fine, too. I didn’t see one in the github repository.
-
I think the problem is going to be that non-UDL languages and UDL languages are vastly different things.
-
@Alan-Kilborn Bummer. Thanks, Alan.
-
I don’t know how similar GDScript is to Python (all I know about GDScript is what I saw from the headlines on this search), but if syntax is basically the same, and it’s mostly just some extra keywords that you’d like to highlight, the Style Configurator has “user-defined keywords” boxes for KEYWORDS and BUILTINS styles, plus the ability to add custom extensions.
For example, if GDScript is basically python, but with the
gd
extension instead ofpy
, and a builtin objectMySuperNode
(and maybe some other KEYWORDS not shown), it might look something like:
You can do more than one word in each blank, so you can add BUILTINS and KEYWORDS to your heart’s content. This was just a quickie example.
-
I am trying to do this same thing except I want to get the auto-complete to work as well. As far as I can tell I would have to edit the perl.xml auto-complete to get this to work.
It would be nice if we could treat all the languages the same to be able to import/export/duplicate them for scripting languages that are built on top of others. -
@Monsterray said in Exporting an Existing Language Defintion?:
I am trying to do this same thing except I want to get the auto-complete to work as well. As far as I can tell I would have to edit the perl.xml auto-complete to get this to work.
To get auto-complete to work, yes, taking an existing one and just tweaking it and giving it the right name is “all” that’s needed.
It would be nice if we could treat all the languages the same to be able to import/export/duplicate them for scripting languages that are built on top of others.
Every built-in langauge has its own separate source code, because most of the built-in go way beyond simple keyword matching. The User Defined Languages (UDL), OTOH, just use simple keyword matching. Without a complete redesign and rewrite – essentially, abandoning the library that Notepad++ currently uses for syntax highlighting (which is guaranteed to never happen, so don’t get your hopes up) – it is not possible to “export” a built-in library to replicate to some other language.
But my answer to you is essentially the same as my answer from almost 5 years ago – if you have a “language” that is similar enough to Perl that you’d want to start from perl as a basis, you could try to just add your own keywords to the already-existing “user-defined keywords” boxes available in the Perl entry in Style Configurator – this allows you to add your own keywords, while keeping all the fancy stuff (like code-folding and brace processing, etc) the same as Perl.