简体   繁体   中英

javascript based code editor for custom language syntax

I need javascript/html based code editor which I will customize for very simple custom coding language.

This editor tools needs to work in an offline solution so the source code must be downloadable or open . Language syntax will be look like very simplified java script even with out variables I will define just 'if then' and 'built in function name' for the custom language.

So it must have configuration support for custom coding language syntax

If you can refer some ready to use solutions, it will be so helpful

I found solution for my own question

I used code mirror

http://codemirror.net/

It has built in support for lots of codding language including JavaScript / C# / VB / C / C++ / CSS / etc

and according the language file you can also modify the supported keywords list

I'm not sure if you'd consider this to be a "code editor", but you can use gedit . You can create a new language definition and put it into a "mylanguage.lang" file, and use it for syntax coloring (look here ).

You can also make plugins for gedit to make it do more stuff for your language, like build an AST or to compile your code, etc. Plugins are written in Python (for better or for worse). Look at this page .

Here's one example of how neat Gedit plugins can be. This is a plugin for Gedit that interfaces with Clang (a C/C++/ObjC compiler) to give the programmer immediate warnings and errors to their code. So you can make a plugin that can analyze your new language's code and check for problems/offer code completion, etc.

Although this may seem somewhat tedious, I don't think you'll find a ready-made solution to your problem. Since your language's syntax is technically different than any other language (albeit perhaps similar to a few), you won't find an editor that magically knows your syntax. But if all you want is code coloring, then Gedit won't be difficult to set up. Unfortunately, the more robust features of an editor will not be quite as easy to make, but definitely possible!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM