Adding new Language Syntax - Discuss thread

Started by Stefan, August 10, 2009, 09:58:27 PM

Previous topic - Next topic

Stefan

Hi Alex,


About Scopes:

What is this?  Explanation please?

   * has_name (true|false|0|1) – indicates that name of the scope follows open tag
   * separator (true|false|0|1) – draw separator after close tag (if enabled in editor settings)

Example: <Scope open="Class" close="End Class" has_name="true" separator="true"/>


-----------------------------
And would you please describe this:
struct="false"/>
strict="false"/>
<Middle text="Then"/>

Quote from: VBS example
     <Scope open="If" middle="Else" close="End If" strict="false">
       <Middle text="Then"/>
       <Middle text="ElseIf"/>
     </Scope>
     <Scope open="Exit Sub" struct="false"/>
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

has_name
this flag was used before labels were added to extract name of scope from text. If has_name set to true, HE takes next word after the open tag as name of the scope (for example function foo(), if function is open scope tag, foo would be selected as name)

separator
if this flag is set, and you have Scope Separators enabled for document/syntax, then after the scope with this flag in source code would be drawn horizontal line.

struct="false"
this is mistyping. Should be strict. Scope definition where you have found this used for preventing recognizing scope close inside of them. That is why no close tag for them defined.

strict="false"
flag tells HE to not take seriously missing close text for this scope. So you would not get a error displayed for open tag and this also used or more correct solving of outlining constructions.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

#2
Question: is there an advice about the order of the xml tags (beside the basics to close and open in the right order)

Should be LABELS above the STYLES or vice versa? Or it it no matter?
Do case of the tags matter?
Can i comment out something in the synatx for test issues?

You may want to add an link to an XML guide/wiki/HowTo.

You may want to add an basic skeleton about the order of tags to your explanations?

Code (xml) Select


<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="syntax.xslt"?>
<XMLConfigSettings>
  <FILEINFO author="HippoEDIT.com" type="LangSpec"/>
  <SYNTAX id="plsql" name="PL/SQL" inherit="def_source" inherit_url="defsource_spec.xml">
   
<SPECIFICATION>
  <FilePattern mask="*.bas;*.frm;*.cls"/>
      <OpenClose>()[]{}""</OpenClose>
      <Operators>?%--+/&amp;*=&lt;&gt;|!~^,;.:()[]</Operators>
      <Delimiters>&quot;'@#{}</Delimiters>
      <Words>0-9A-Za-z_</Words>
      <Bars navigation="true"/>
    </SPECIFICATION>
   
<SCOPES>
      <Scope open="(" close=")"/>
    </SCOPES>
   
<LABELS>
      <Label group="Table" match="" name="" descr="" image="8" scope="1"/>
    </LABELS>

    <STYLES>
      <Style id="com" name="Com" text="1" bold="0" italic="1" underline="0" clr="Com" bkclr="#F">
        <Blocks>
          <Block open="/*" close="*/"/>
        </Blocks>
        <Containers>
          <Close id="normal"/>
        </Containers>
        <Keywords>
          <Keyword text="ALL"/>
        </Keywords>
    </STYLES>

  </SYNTAX>
</XMLConfigSettings>

Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Thanks Stefan,

I already long time want to do the same, because I would be forced to create new posts on that thread (because of message size limit) and post which are not directly a part of the FAQ make reading more complex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

alex

There is no specific order in XML tags necessary.
But for keywords it is better to keep alphabetic order - this way internal loading faster.

All tags and attributes are CASE SENSITIVE.

All not English text should be correctly encoded in UTF-8

You can use comments, comment some parts etc.

Because it is XML some symbols should be converted to entity (even inside attributes):
<    =>     &lt;
>    =>     &gt;
&    =>     &amp;
"     =>     &quot;


If you want to use some where (not everywhere allowed) line breaks or tabs you can represent them as following:
Any kind of line breaks (\r\n, \n\r, \r, \n)   =>     \n  - all line breaks use dos style at the end (\r\n)
Tab character (0x09)                                 =>    \t
\n combination                                          =>    \\n
\t combination                                          =>    \\t
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

c_igor

Hi I am new here, and I need some help with syntax file for the NetRexx lang.

Problem is how to set scopes without closing frase.
for example

class MyClass1
   /*vars here*/
   method m1
      /* operators here*/
   method m2
      /*....*/
class MyClass2
....
So
End of class - line before next class definition (MyClass2 in example)
End of method - line before next method or class definition

Is it possible set scopes "class - class" and "method - method"
If I set open scope and close scope to "method" - second (and 4-th...) method not in scopes.

Thank you.
Igor

alex

Hi Igor,

welcome on forum.

No, I think there is no way to achieve this with current engine functionality.
What you want is something like:
close currently open tag, if next tag is open.

Even if you say:
close current scope, if scope with same open tag opens.
will also not work, because with case of method m2, there is no next method, but start of next class.

Maybe will works something:
close current scope, if open tag of same type scope starts or open tag of parent scope (one in stack before) starts.
But this is will not help in case of class scopes.

While it is not only new rules for closing, but also for definition to which scope can be in which...
So, particular case of cause can be solvable, but it should be generic solution to be implemented.

I will think what can be done here (another case for such scope definitions is INI files) but do not promise something.
You can help here, trying to define clear mockup of rules, that will cover all cases.

So, you are not able to define scopes here, but can define label (not scope bound), that will also help in navigation.

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Prinz Bernhard

Hilfe erbeten,

ich bin neu dabei und würde gerne für Hippo Edit
für die Sprache "Informix 4GL" ein Syntax-File bauen,
finde aber keinen Einstieg, wie ich das machen kann.

Kann mir jemand  Links senden für
- wie fang ich an
- Beschreibung der XML-Datei 
- wie teste ich eine Datei


alex

HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]