Author Topic: Oberon-07  (Read 405 times)

Offline 0CodErr

  • Registered User
  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Oberon-07
« on: May 05, 2018, 12:54:07 PM »
Hello!
At first thanx for the best text editor.

I tried to implement Oberon07 syntax scheme.
Oberon07 report can be found here:
 inf.ethz.ch/personal/wirth/Oberon/Oberon07.Report.pdf [nofollow]
See topics on the KolibriOS forum in russian:
board.kolibrios.org/viewtopic.php?f=33&t=2443&start=45#p70428 [nofollow]
board.kolibrios.org/viewtopic.php?f=33&t=2443&start=60#p70436 [nofollow]
and last update:
board.kolibrios.org/viewtopic.php?f=33&t=2443&start=60#p70495 [nofollow]

I have a problem with an implementing nested comments.
Current implementation — is not completely right way.
« Last Edit: May 07, 2018, 06:23:08 PM by alex »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2214
  • Karma: +37/-3
    • HippoEDIT
Re: Oberon-07
« Reply #1 on: May 05, 2018, 03:57:50 PM »
Hi,

thanks for sharing.

Can you please provide an example file in Oberon language for testing the schema?
Also, please, based on the example explain what works not as expected.
I will try to help.

BR, Alex.

Offline 0CodErr

  • Registered User
  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Oberon-07
« Reply #2 on: May 05, 2018, 05:46:26 PM »
explain what works not as expected
Problem is that comments can only be nested twice(but no more), i.e.:
Code:
  1. (*
  2.    (*
  3.     *
  4.     *  (* *** *)
  5.     *
  6.     *)
  7. *)
That's because I don't know how to do it right way.
I implemented it like this:
Code: XML
  1. <Style id="comment"...
  2.  <Blocks>
  3.     <Block open="//" close="\n"/>
  4.     <Block open="(*" close="*)"/>
  5.   </Blocks>
  6. </Style>
  7. <Style id="comment1"...
  8.  <Containers>
  9.     <Open id="comment"/>
  10.     <Close id="comment"/>
  11.   </Containers>
  12.   <Blocks>
  13.     <Block open="(*" close="*)"/>
  14.   </Blocks>
  15. </Style>
  16. <Style id="comment2"...
  17.  <Containers>
  18.     <Open id="comment1"/>
  19.     <Close id="comment1"/>
  20.   </Containers>
  21.   <Blocks>
  22.     <Block open="(*" close="*)"/>
  23.   </Blocks>
Can you please provide an example file in Oberon language for testing the schema?
I provided two examples in the attachment.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2214
  • Karma: +37/-3
    • HippoEDIT
Re: Oberon-07
« Reply #3 on: May 07, 2018, 02:49:27 PM »
Hi,

for allowing comments nesting, you only need to allow that comment style is also allowed in normal style. Any style is implicitly allowed inside of normal style until you do not overwrite a container section. Than only defined there (or inherited explicitly defined containers) are allowed.
Code: XML
  1. <Style id="comment" name="Comments" text="1" bold="0" italic="1" underline="0" clr="Comments">
  2.         <Containers>
  3.                 <Open id="normal"/>
  4.                 <Open id="comment"/>
  5.         </Containers>
  6.         <Blocks>
  7.                 <Block open="//" close="\n"/>
  8.                 <Block open="(*" close="*)"/>
  9.         </Blocks>
  10. </Style>

I agree, that it is not obvious and also was not documented. So, I have updated the wiki accordingly:
https://wiki.hippoedit.com/syntax/containers

I have updated your schema (comments + some other small adjustments) and placed it, together with examples on guthub, so that we can track changes easily:
https://github.com/hippoedit/syntax/tree/master/Oberon-07

The schema already looks OK and if you do not mind, I can place it in the online repository, that users can download the schema automatically when opening Oberon files.
Is it OK for you?

If you have other questions, I would be glad to help.

BR, Alex.
P.S: and thank you for writing in English ;)


Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2214
  • Karma: +37/-3
    • HippoEDIT
Re: Oberon-07
« Reply #4 on: May 07, 2018, 06:32:44 PM »
  • to not force closing element on scopes, one can set strict=false. Wiki...
  • Regular expressions are supported. But not in SPECIFICATION section, only in Styles. You can create an extension for numbers style, and add there needed Regexp. But there are some limitations for regular expressions.

Code: XML
  1. <Style id="number" extend="true">
  2.   <Blocks>
  3.     <Block open="0x">
  4.        <Close noneof="0-9A-Fa-fU"/>
  5.     </Block>
  6.     <Regexp text="\\d+e[\\-\\+]\\d+"/>
  7.     <Regexp text="\\d+(?:[ulUL]{1,2}|f)"/>          
  8.   </Blocks>
  9. </Style>
« Last Edit: May 07, 2018, 06:35:50 PM by alex »

Offline 0CodErr

  • Registered User
  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Oberon-07
« Reply #5 on: May 09, 2018, 10:38:24 AM »
for allowing comments nesting, you only need to allow that comment style is also allowed in normal style.
Oh, thanx! I didn't know about it.
I have updated your schema (comments + some other small adjustments) and placed it, together with examples on guthub, so that we can track changes easily
Thanx again  :)
The schema already looks OK and if you do not mind, I can place it in the online repository, that users can download the schema automatically when opening Oberon files.
Is it OK for you?
Yes, it OK for me.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2214
  • Karma: +37/-3
    • HippoEDIT
Re: Oberon-07
« Reply #6 on: May 09, 2018, 11:45:19 AM »
Ok, then I would add it to the repository.

Please check also my advises about strict and regular expressions.
You may submit your changes directly to GitHub. Send me your github registration name and I would add you as a collaborator.

New syntax scheme appreciated by a HippoEDIT license if you need it - I have sent you a personal message with details.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2214
  • Karma: +37/-3
    • HippoEDIT
Re: Oberon-07
« Reply #7 on: May 09, 2018, 09:04:10 PM »