Syntax schema definition
Here you can find a basic description of HippoEDIT syntax schema structure and navigate to more detailed topics.
How long it takes to create new syntax schema
The time you need to create a new syntax schema depends on the programming language syntax complexity and on the language syntax “uniqueness”.
Normally if the language has C-like syntax, you will need less than 1 hour to create the basic skeleton of the new syntax schema. For more complex languages it could take up to 3 hours. Of course, the time also depends on how familiar you are with HippoEDIT syntax definition rules. Looking at a similar existing syntax as an example can help.
If you have an existing syntax schema for UltraEdit, TextPad or PSPad you can greatly speed up creation by converting the existing schema into HippoEDIT syntax definition schema using Syntax Tools Plugin.
More advanced syntax configuration as: labels (to get function list working), code templates and tools definition will take some more time but will give you a chance to work more effectively with source code for which you build the schema.
If you have questions about creating or need assistance you can always ask on forum or supportbox. Creating a new syntax schema gets you a free HippoEDIT license.
Files
The definition of the programming language (syntax) in HippoEDIT is based on two files: {lang_name}_spec.xml and {lang_name}_user.xml. Names of the file are not important – definition recognized by XML header. {lang_name}_spec.xml contains general definition of the syntax and is obligatory. {lang_name}_user.xml contains definition of the user specific settings for language (such as code templates, programming language specific tools, language help urls etc.) and is optional. Definition files should be placed in directory defined in Tools→Options→General→Settings Path. By default this is {Installation Directory}\data\syntax.
First steps
To create your own syntax I would suggest searching the existing schemas for a language similar to the one you want to have and copy + rename files. Then open new files and search for something similar to this:
<SYNTAX id="asm" name="ASM" inherit="def_source" inherit_url="defsource_spec.xml">
Syntax attributes
- id (any string, preferably low case, without spaces and symbol : ) – unique id of the language (obligatory)
- name (any string) – description of the language that would be used in UI
- inherit (any id) – name of base (parent) schema. The new scheme would inherit all settings, styles of the parent. Normally you need to inherit from def or def_text or def_source. These schemes contain a base definition for styles, without them a lot of functionality would not be available.
- inhertit_url (file path, relative or absolute) – name of parent schema file. Used only for navigation between schemas when opened in the browser (optional).
- abstract (boolean, true/false, the default is false) - if set to true, the syntax will not be used for direct document syntax, but only as a base for some other syntax
- version (string, in form of N.N) - version of the syntax schema
- required (string, in form of N.N) - minimum version of the HippoEDIT to ensure proper syntax highlighting
- preferred (string, in form of N.N) - minimum optimum version of the HippoEDIT to ensure the best level of syntax highlighting
- author (any string) - author of the schema. If not set, author from FileInfo node is used
- email (any string) - email of the author
After creating the definition files and copying them into {Data} folder, HippoEDIT should load definitions and display them in Available Languages list (Tools→Options→Available Languages).
Structure
General rules
- There is no specific order of XML tags necessary. But for keywords, it's better to keep alphabetic order - this way internal loading is faster.
- All tags and attribute name are CASE SENSITIVE.
- Whole not English text should be correctly encoded in UTF-8
- You can use comments, comment some parts etc.
How to Modify an existing syntax schema
Direct modifications of default syntax schemes are NOT recommended. The reason is, that your modifications may be overwritten by HippoEDIT update (installation on top) and you will need to repeat them once more.
The recommended way for modification is creating new syntax schema, inheriting from the original one, and adding new styles or overwriting inherited ones, for example. To not have conflicts with the detecting of proper syntax on document open (you have two syntax schema definitions reacting on same file mask, due to inheriting) you can disable original syntax in Tools->Options->Syntax Settings (uncheck it in the list).
Example of syntax schema for HTML, adding new style:
- my_html_spec.xml
<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="syntax.xslt"?> <XMLConfigSettings> <FILEINFO author="HippoEDIT Happy User" type="LangSpec"/> <SYNTAX id="my_html" name="My HTML" inherit="html" inherit_url="html_spec.xml" version="1.0"> <STYLES> <Style id="src_attribute" name="Source Attribute" bold="0" italic="0" underline="0" clr="Strings" bkclr="#856363A0"> <Containers> <Open id="xml_open_tag"/> </Containers> <Blocks> <Regexp open=""" open_lead="=crs" close="""/> <Regexp open="'" open_lead="=crs" close="'"/> </Blocks> </Style> </STYLES> </SYNTAX> </XMLConfigSettings>