Author Topic: Euphoria syntax file  (Read 6473 times)

jeremy_c

  • Guest
Euphoria syntax file
« on: July 30, 2009, 12:57:53 am »
Euphoria has spent most of it's life as a closed source commercial programming language however, with it recently being open sourced, many developers have been doing some very nice additions to it. Euphoria 4.0 will be released soon. http://openeuphoria.org/

I have attached a syntax file that is written from the ground up to support older Euphoria syntax and include the new 4.0 syntax.

Updated 2009-08-09: Correct Euphoria syntax file. Also included ETML (HTML intermixed with Euphoria) and ETAG (Special HTML tag support intermixed with Euphoria code). The later two are only of interest to Euphoria programmers, of course.
« Last Edit: August 10, 2009, 03:13:06 am by jeremy_c »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Euphoria syntax file
« Reply #1 on: July 30, 2009, 04:03:20 pm »
Hello Jeremy,

thanks for the syntax schemes! If you would like to update schema, you can just delete old attached file and add new one, or just attach it with note that this newer version. I would also update files in library (with link to forum) to newer version.

Just for info (do not know exactly what is better). If it has sense to have syntax schema for Euphoria 2.5 and 4.0 separately, you can just inherit 4.0 schema from 2.5 schema file. Then you can only add in 4.0 schema new keywords, scopes and labels and inherit all contents of 2.5 schema. In this case users can switch between them. The example is c++ schema and inherited from it c++ (MS) schema.

Best regards,
Alex.

jeremy_c

  • Guest
Re: Euphoria syntax file
« Reply #2 on: July 30, 2009, 05:36:38 pm »
4.0 is backward compatabile with 2.5 (for the most part). 2.5 is not available any longer.  1.x and 2.x were released while Euphoria was commercial. There are still some users who have old 2.5 versions, but they are few and far between and they will not be growing any as it's impossibe to get 2.5. 4.0 is the current version. I do not see any reason in keeping a 2.5 syntax version around.

Jeremy

jeremy_c

  • Guest
Re: Euphoria syntax file
« Reply #3 on: July 31, 2009, 10:04:27 pm »
I'm not sure how  I did it but I uploaded the wrong copy. However, before I upload the new copy, I want to see if this problem can be worked out... When I type:

Code: [Select]
procedure hello_world()
puts(1, "Hello, World!\n")
end procedure
-- cursor is here

I actually wind up with:

Code: [Select]
procedure hello_world()
puts(1, "Hello, World!\n")
end procedure
        -- cursor is here

i.e. it is indenting on the "end procedure" not on the "procedure hello_world()". Is there any way to fix this? The code I have is:

        <Scope open="function" close="end function" has_name="true" separator="true"/>
        <Scope open="procedure" close="end procedure" has_name="true" separator="true"/>

Of course, inside of the <SCOPES> tag.

Jeremy


Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Euphoria syntax file
« Reply #4 on: August 01, 2009, 12:07:57 am »
Hi Jeremy,

once more:

when you pressed enter after end procedure in your example you got this:

Code: [Select]
procedure hello_world()
puts(1, "Hello, World!\n")
end procedure
-- cursor is here (to tabs indent)
end procedure

or this:
Code: [Select]
procedure hello_world()
puts(1, "Hello, World!\n")
end procedure
-- cursor is here
(from my understanding this, second case, is correct)

first case I got trying your scenario. If you press Enter after procedure you execute default code template for expanding procedure to procedure \r\n end procedure that is generally correct, because template does not care what is before trigger key. I can think about this, but do not see the way to solve this generically now. 
And this issue is not related to syntax schema.

If I do not accept code hint and then press enter, I get next line indent as in second example. That is correct.

Can you comment on this? How it is in your case?

Best regards,
Alex.

jeremy_c

  • Guest
Re: Euphoria syntax file
« Reply #5 on: August 01, 2009, 12:10:54 am »
I have the code expansion based on style/scope turned off. Thus, I do not get the end procedure as you do. However, I do get an indent. such as this:

Code: [Select]
end procedure
        -- cursor is here

Jeremy

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Euphoria syntax file
« Reply #6 on: August 01, 2009, 12:27:07 am »
Yes. Now I can reproduce it (I had also Auto-Indent turned off, because of some tests).
And see two problems:
 - when pressing enter after procedure on first line indent of the next line is 0
 - after third line indent is as you have shown

Both are bugs and would be fixed with new 1.45 beta these weekends.

Best regards,
Alex.

jeremy_c

  • Guest
Re: Euphoria syntax file
« Reply #7 on: August 01, 2009, 12:28:48 am »
Thanks Alex!

Jeremy

jeremy_c

  • Guest
Re: Euphoria syntax file
« Reply #8 on: August 15, 2009, 04:36:30 am »
How do I support a number format such as:  #9AF ? Currently I have:

         <Numbers>-+0-9A-Fa-ftx\#._</Numbers>

As Euphoria allows things such as:

100_000.00 -- 100,000.00
0b101 --> binary = decimal 5
0t101 --> octal = decimal 65
0d101 --> decimal = decimal 101
0x101 --> hex = decimal 257
#A --> hex = decimal 10

Normal numbers, plus the first 5 of the above work but I cannot get #A, #9EF, #abc to work.

Jeremy

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Euphoria syntax file
« Reply #9 on: August 15, 2009, 03:22:21 pm »
Hi Jeremy,

looks like some "optimization" from my side :)

Code: [Select]
// check that starts with plain number
if (! _istdigit(*pszChars) && *pszChars != _T('-'))
return false;

Maybe I would change this with new beta (do not know, this influence performance, and way I suggested is also Ok, so maybe not :) ), but till then you can use such way of highlighting (check cbase_spec.xml for example):
Code: [Select]
      <Style id="number" extend="true">
        <Blocks>
          <Block open="#">
            <Close noneof="0-9A-Fa-f"/>
          </Block>
        </Blocks>
      </Style>

And remove then # from Numbers definition.

Best regards,
Alex.

chameau

  • Guest
Re: Euphoria syntax file
« Reply #10 on: November 14, 2009, 11:04:03 pm »

Hello, I usally set the setHandler immediately after the procedure; looks something like this:


procedure Endpgm (integer self, integer event, sequence parms)
 ....
end procedure
setHandler(MainWindow, w32HClose, routine_id("Endpgm"))


Now when I look at the function bar I see this:

Endpgm
setHandler

Of course, I don' want to see the "setHandler"; I tried to change the group="Function" in euphoria_spec.xml, but I seem to have no luck - can somebody have a look into this and give me a hint?

Thank you in advance !


Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Euphoria syntax file
« Reply #11 on: November 15, 2009, 02:10:54 am »
Hi Thomas,

hint is here - Lookbehind in Regular Expressions.

I have chnaged definition of labels in such way, and now it works like you want (I think such problem also exist in other syntaxes ehich have multi word scope tags with end).
Code: [Select]
      <Label group="Function" match="(?&lt;!end)(?:\s|^)(function|procedure|type)\s+(\w+)\s*(\([^)]*\))" name="\2" descr="\1 \2 \3" scope="1" image="9"/>
      <Label group="Function" match="(?&lt;!стоп)(?:\s|^)(функция|процедура|тип)\s+(\w+)\s*(\([^)]*\))" name="\2" descr="\1 \2 \3" scope="1" image="9"/>     

You can update your file manually or can download version from library (already updated).

Best regards,
Alex.

chameau

  • Guest
Re: Euphoria syntax file
« Reply #12 on: November 15, 2009, 10:40:37 am »
Hi Alex,

YES, you did it! That's the way I wanted to see my function list ... I really regret I didn't ask in this forum before. I tried myself, but these Regular Expressions are very mighty, too mighty for me  >:(  ?
I must have a look at the boost.org page in detail when I got lots of time time (vacation?).

Let me thank you for your fast reaction and response and have a good time !

Best regards,

Thomas



 

Related Topics

  Subject / Started by Replies Last post
TCL syntax file

Started by pokey Syntax Files

1 Replies
2710 Views
Last post March 26, 2009, 06:00:05 pm
by alex
1 Replies
3671 Views
Last post April 15, 2009, 09:50:42 pm
by alex
AWK syntax file

Started by rjbull Syntax Files

5 Replies
8125 Views
Last post July 27, 2009, 01:04:00 pm
by alex
Lua syntax file

Started by scottbilas Syntax Files

5 Replies
4004 Views
Last post December 25, 2009, 06:26:04 pm
by alex
0 Replies
2919 Views
Last post June 25, 2009, 11:10:17 pm
by alex