Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| syntax:start [2014/11/07 15:23] – [Syntax schema definition] admin | syntax:start [2018/03/23 12:46] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Syntax schema definition ====== | ====== Syntax schema definition ====== | ||
| - | Here you can find basic description of HippoEDIT [[terms: | + | Here you can find a basic description of HippoEDIT [[terms: |
| - | ====== How long it takes to create new syntax schema | + | ===== How long it takes to create new syntax schema ===== |
| - | The time you need to create new syntax schema depends on programming language syntax complexity and on language syntax " | + | The time you need to create |
| - | Normally if language has C like syntax, you will need less than 1 hour to create basic skeleton of new syntax schema. For more complex languages | + | Normally if the language has C-like syntax, you will need less than 1 hour to create |
| - | If you have existing syntax schema for UltraEDIT, TextPad or PSPad you can greatly speed up creation by converting existing schema into HippoEDIT syntax definition schema using [[plugins: | + | If you have an existing syntax schema for UltraEdit, TextPad or PSPad you can greatly speed up creation by converting |
| - | More advanced syntax configuration as: labels (to get "function list" | + | More advanced syntax configuration as: labels (to get [[view: |
| - | If you have questions about creating or need an assistance you can always ask on forum or supportbox. Creating | + | If you have questions about creating or need assistance you can always ask on forum or supportbox. Creating |
| ===== Files ===== | ===== 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 is 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 | + | 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 {[[options: |
| ===== First steps ===== | ===== First steps ===== | ||
| - | To create your own syntax I would suggest | + | To create your own syntax I would suggest |
| Then open new files and search for something similar to this: | Then open new files and search for something similar to this: | ||
| <code xml>< | <code xml>< | ||
| ==== Syntax attributes ==== | ==== Syntax attributes ==== | ||
| - | * **id** (any string, | + | * **id** (any string, |
| * **name** (any string) – description of the language that would be used in UI | * **name** (any string) – description of the language that would be used in UI | ||
| - | * **inherit** (any id) – name of base (parent) schema. | + | * **inherit** (any id) – name of base (parent) schema. |
| - | * **inhertit_url** (file path, relative or absolute) – name of parent schema file. Used only fir navigation between | + | * **inhertit_url** (file path, relative or absolute) – name of parent schema file. Used only for navigation between |
| + | * **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 // | ||
| + | * **email** (any string) - email of the author | ||
| - | After creating | + | After creating the definition files and copying them into {Data} folder, HippoEDIT should load definitions and display them in Available Languages list (// |
| ===== Structure ===== | ===== Structure ===== | ||
| Line 38: | Line 44: | ||
| ===== General rules ===== | ===== General rules ===== | ||
| - | * There is no specific order in XML tags necessary. But for keywords it is better to keep alphabetic order - this way internal loading faster. | + | * There is no specific order of XML tags necessary. But for keywords, it' |
| * All tags and attribute name are CASE SENSITIVE. | * All tags and attribute name are CASE SENSITIVE. | ||
| - | * All not English text should be correctly encoded in UTF-8 | + | * Whole not English text should be correctly encoded in UTF-8 |
| * You can use comments, comment some parts etc. | * 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. | ||
| + | <note tip> | ||
| + | |||
| + | 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 [[options: | ||
| + | |||
| + | Example of syntax schema for HTML, adding new style: | ||
| + | <file xml my_html_spec.xml> | ||
| + | <?xml version=" | ||
| + | <? | ||
| + | < | ||
| + | < | ||
| + | <SYNTAX id=" | ||
| + | < | ||
| + | <Style id=" | ||
| + | < | ||
| + | <Open id=" | ||
| + | </ | ||
| + | < | ||
| + | <Regexp open="& | ||
| + | <Regexp open="& | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| ===== Advanced ===== | ===== Advanced ===== | ||
| * [[syntax: | * [[syntax: | ||
| * [[syntax: | * [[syntax: | ||
| - | <note tip>The easiest way to start with creating | + | <note tip>The easiest way to start with creating |