Author Topic: Adding new Language Syntax - Discuss thread  (Read 5742 times)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Adding new Language Syntax - Discuss thread
« on: August 10, 2009, 08:58:27 pm »
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"/>
« Last Edit: November 02, 2009, 10:37:55 pm by Stefan »
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2161
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Adding new Language Syntax
« Reply #1 on: August 10, 2009, 11:06:11 pm »
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.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Adding new Language Syntax - Discuss thread
« Reply #2 on: November 02, 2009, 10:49:22 pm »
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
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <?xml-stylesheet type="text/xsl" href="syntax.xslt"?>
  4. <XMLConfigSettings>
  5.   <FILEINFO author="HippoEDIT.com" type="LangSpec"/>
  6.   <SYNTAX id="plsql" name="PL/SQL" inherit="def_source" inherit_url="defsource_spec.xml">
  7.    
  8.         <SPECIFICATION>
  9.           <FilePattern mask="*.bas;*.frm;*.cls"/>
  10.       <OpenClose>()[]{}""</OpenClose>
  11.       <Operators>?%--+/&amp;*=&lt;&gt;|!~^,;.:()[]</Operators>
  12.       <Delimiters>&quot;'@#{}</Delimiters>
  13.       <Words>0-9A-Za-z_</Words>
  14.       <Bars navigation="true"/>
  15.     </SPECIFICATION>
  16.    
  17.         <SCOPES>
  18.       <Scope open="(" close=")"/>
  19.     </SCOPES>
  20.    
  21.         <LABELS>
  22.       <Label group="Table" match="" name="" descr="" image="8" scope="1"/>
  23.     </LABELS>
  24.  
  25.     <STYLES>
  26.       <Style id="com" name="Com" text="1" bold="0" italic="1" underline="0" clr="Com" bkclr="#F">
  27.         <Blocks>
  28.           <Block open="/*" close="*/"/>
  29.         </Blocks>
  30.         <Containers>
  31.           <Close id="normal"/>
  32.         </Containers>
  33.         <Keywords>
  34.           <Keyword text="ALL"/>
  35.         </Keywords>
  36.     </STYLES>
  37.  
  38.   </SYNTAX>
  39. </XMLConfigSettings>
  40.  
  41.  
« Last Edit: July 14, 2011, 05:21:44 am by alex »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2161
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Adding new Language Syntax - Discuss thread
« Reply #3 on: November 02, 2009, 10:51:06 pm »
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.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2161
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Adding new Language Syntax - Discuss thread
« Reply #4 on: November 02, 2009, 11:00:48 pm »
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):
Code: [Select]
<    =>     &lt;
>    =>     &gt;
&    =>     &amp;
"     =>     &quot;

If you want to use some where (not everywhere allowed) line breaks or tabs you can represent them as following:
Code: [Select]
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

Offline c_igor

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Adding new Language Syntax - Discuss thread
« Reply #5 on: October 15, 2012, 08:52:35 am »
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

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2161
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Adding new Language Syntax - Discuss thread
« Reply #6 on: October 15, 2012, 01:13:37 pm »
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.

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
3325 Views
Last post December 01, 2008, 04:41:11 pm
by alex
4 Replies
11118 Views
Last post May 04, 2010, 05:19:52 pm
by alex
1 Replies
3364 Views
Last post February 23, 2009, 03:11:01 pm
by alex
4 Replies
2108 Views
Last post April 02, 2009, 09:54:18 pm
by alex
1 Replies
1952 Views
Last post January 04, 2013, 03:06:10 pm
by alex