Higher parsing priority for SCOPES ?

Started by Stefan, December 29, 2009, 12:34:00 AM

Previous topic - Next topic

Stefan

To make an snippet file i add an SCOPE mySS<>mySE

   <SCOPES>
         <Scope open="myss" close="myse"/>
   </SCOPES>

But this doesn't works IF the code in between has an error,
as for example i had an un-closed FUNCTION (because this was no function but the word "Function" only.
This has the effect that the SCOPE is just not closed (see picture)
An solution was to misspell the word Functio-n or add an 'end function'


The same problem i have with other example code blocks, which are all example descriptions...
but i think this also happens if my real code has an error... and i just want to fold this part of code
even with this error, to fix this later.

So i want to ask:
is there an option, or could this be an feature request, to give the SCOPE an higher priority
to work even if other SCOPES like Function or other code has error, or is just un-finished?
I mean smtg like "force folding"  :P

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

alex

Hi Stefan,

you can not set a priority to scope or force it to be closed even if there are errors in scope structure. When HE CAN resolve scopes it does it :)
From my point of view, you use scopes in your example not as they are designed. Normally such "pseudo" regions should be placed in comment (or special format) style as it done in cbase_spec.xml. Then you will not have such problem. I think. But read further.

BUT. There are two scope flags which maybe can help.

  • strict - default == true. When set to == false, tells HE, that this type of scope not always have close tag. This helps in resolving, because then HE can skip such scope tag if before matching scope with strict == true found. Also unclosed scopes with strict == false not marked as error. Example html_spec.xml
  • decoration - default == false. New scope flag added in 1.47. Problems for scope intersections. This can happen in some cases in multi syntax documents or if preprocessor directives are used. Then you can start scope in one php block or (preprocessor block) and close language scope in another preprocessor block. Such situations were not resolved correctly. Now new directive for scopes added (decoration="true", default = false) that mark such scopes and allow to process intersection better. Scopes with such flag processed separately, and not influenced by scopes with decoration == false (default).

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

Stefan

#2
Many thanks for your responce Alex.
* For "or special format) style as it done in cbase_spec.xml."  .... can you point me to the part you had in mind?
* For strict i had to modify all other scopes with strict=false, isn't it?
* And this
     <Scope decoration="true" open="myss" close="myse"/>
 didn't had an effect for me, or i did it wrong.



But i am able to learn  ;D

Because this seams to works in first tests:


   <SCOPES>
     <Scope open="myss" close="myse"/>
     </SCOPES>      
   <STYLES>
     <Style id="snippet" name="snippets" text="1" bold="0" italic="1" underline="0" clr="Comments" bkclr="#FFFFFFFF">
       <Containers>
         <Open id="comments"/>
         <Open id="normal"/>
       </Containers>
       <Blocks>
        <Block open="mySS" close="mySE"/>
       </Blocks>
     </Style>


I interpret this as
- all between mySS and mySE
- IF inside STYLE normal or comment (containers)
- is STYLE snippet
and so use an very own rule set for this part of code.
(not sure if container is good use here, or if even needed.   Will test...)


If i am succeed i can provide an howto made an snipped file to use in HE.

BTW: mySS means mySnippetregionStart and mySE my SnippetregionEnd ( i had no better idea right now)
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hi Stefan,

here is an example from cbase_spec.xml:

      <Scope open="region" close="endregion" has_name="true">
        <Containers open="format_tag"/>
      </Scope>
....
      <Style id="format_tag" name="Format tags" bold="2" italic="1" underline="0" clr="Format tag" bkclr="#FFFFFFFF"/>


where style format_tag is extended later in child schema c++_spec.xml (this can be also done in same schema):
      <Style id="format_tag" extend="true">
        <Blocks>
          <Block open="//$" close="\n"/>
        </Blocks>
      </Style>


I think this basically the same what you have found by your own, but in case of C++ regions scope tags are not the same as tags for style blocks. This is safer. And more clear for any other editor or compiler using your source later.
Just to clarify: // is comment in C++, format tag uses combination //$ (fex) to look like a comment for all other consumers (except of HE) as normal comment.
Containers for format_tag (you can use any style name here) are as for comments - normal. Same as you define no containers.
Then you just need to tell you scope definition in which style (container) it can be found:
        <Containers open="format_tag"/>

************************************
With strict==false. Yes, then you need to mark all other scopes as non strict. But I think this is wrong way. Because they should be closed. But just you try to create your own regions and integrate them into current syntax. I think you need to model them as comments as you have done.

************************************
About decoration="true", looks like you have done everything correct, and should work, but to understand why it does not I need to see complete schema and example file. But the way you have done is more correct.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]