Emerald Editor Discussion
September 26, 2017, 10:36:50 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3
  Print  
Author Topic: Enhancement Discussion: Syntax  (Read 30949 times)
0 Members and 1 Guest are viewing this topic.
hetman
Miner
**
Posts: 17


« on: June 26, 2008, 02:10:17 pm »

Hi guys. So after a long surch for an editor with some more modern features (unicode, powerful syntax highlighting, etc...) I've found the only one that can match the actual text editing capabilities of Crimson is sadly only available on OS X. Looks like I'm stuck with Crimson for a while yet.

So I guess it falls on me to make my most desperate feature additions. I can't really find a place where new features can be discussed accepted/rejected, who are the developers that make the final call or what the process is. However I'd like to get some feedback before putting in effort into patches.

I'll post my stuff in the forum to start with, not really sure if the bug tracker is a better place for this, let me know and I can dump it in there instead if that's that case.


So here's the first round of additions in mind: I've found Crimson syntax highlighting is almost adequate for Python, but leaves Ruby looking like a desolate wasteland. Which of course is quite unacceptable Smiley

I've played around with the source and so far have made the following alterations:
- Added two additional variable types (they're really a duplication of what's already there). This is useful in Ruby where not only do you have global variables (eg: $1), but also class and instance scoped attributes (@@class_variable, @instance_variable), and symbols (:symbol). Note: There's another syntax for symbols made from strings (:'symbol with whitespace') but it's rarer and I can live without it until I get desperate Tongue
- For generality the variable options in the SPC file are now: $VARIABLEnPREFIX, $VARIABLEnENCLOSEDBY, $SPECIALVARIABLEnCHARS with n = 1-3 . I've kept the old style numberless options so we don't break all the already present syntax files.
- The addition of symbol type of variables will of course clash in Ruby with namespace qualifiers (like Mod::Klass, is :: a namespace qualifier or is :Klass a symbol?), so I've extended each variable type with the option $VARIABLEnNOTAFTERCHARS. This fixes the namespace problem.
- Added regular expressions. They're just like strings but get their own colouring scheme. Unfortunately there will be a conflict in languages that use / as an operator, and // to delimit regular expressions. I'm working on this problem now but that'll be left for a future patch. This is going to require some tweaks to the syntax engine for a reasonably general fix.
- Still need to update documentation to reflect syntax file additions.

Some other additions, as of a couple days ago I'm finding the docstrings generated by some fellow developers in Python break. For example this becomes confused: '''Hello, it's a lovely day.''' So I think the best way I can fix this is with:
- Change string quote specification from a single character to a string of characters. That way we can define ''' as a string quote.
- Add a fourth string quote type, since python allows: ', ", ''' and """.


That's all from me for now. Love to get some feedback so I can start on getting those patches in.

Cheers
Logged
Pvt_Ryan
Master Jeweller
******
Posts: 422



WWW
« Reply #1 on: June 26, 2008, 02:49:14 pm »

Hi,

Looks good.

Can you please post a unified diff of your changes?
or
Preferably can you open a Bug for each catagory of changes and then submit a unified diff for that change to the new bug.

One of us will review your changes to make sure they aren't causing any regression or introducing obvious bugs and then commit on your behalf.

After a few commits we will see about getting you commit access.

Feel free to pick bugs from the tracker and fix them as well Wink

Regards,

Ryan

Edit:

As a rule of thumb, post here with what you are going to change and then if there are no objections create a bug (enhancement) and post the diffs to it.
« Last Edit: June 26, 2008, 02:51:18 pm by Pvt_Ryan » Logged
pn8830
Global Moderator
Jeweller
*****
Posts: 252



« Reply #2 on: June 26, 2008, 04:07:14 pm »

Yeah! Show us the code! Smiley Smiley

If it reaches the working build I would appreciate some description of what is added so I can update docs respectively.

Thanks!
PN
Logged

Entities should not be multiplied beyond necessity
hetman
Miner
**
Posts: 17


« Reply #3 on: June 30, 2008, 01:42:05 pm »

Check out bug 167 for the patch for the first set of changes I discussed. Unfortunately both the variable additions and regex additions are lumped into the single patch... both of these changes were but a minor phase of an initially far grander plan and so I didn't think to work on them as seperate, lol.

Once I get some feedback on the initial lot I'll make a start on the Python strings.

Cheers
Logged
hetman
Miner
**
Posts: 17


« Reply #4 on: July 13, 2008, 07:17:17 am »

How are you guys going with getting that patch tested?
Logged
pn8830
Global Moderator
Jeweller
*****
Posts: 252



« Reply #5 on: July 15, 2008, 02:03:28 pm »

Yeah. That looks a little silent Wink I'm waiting for changes to be committed so I can put my hands on it.
PN
Logged

Entities should not be multiplied beyond necessity
Pvt_Ryan
Master Jeweller
******
Posts: 422



WWW
« Reply #6 on: July 16, 2008, 11:23:28 am »

I updated the bug report..

I cant get the patch to apply.
Logged
hetman
Miner
**
Posts: 17


« Reply #7 on: July 20, 2008, 06:49:44 am »

G'day. Yeh I saw that. I uploaded a seperate archive with all the binary files to go with the patch the same day after your message in the bug. Weird though, the bug tracker reports my last update time but your name as the last update to the bug :-/

That include file you mentioned: resource.h, started with a large number of NULL characters and so was originally checked into the repo as a binary file too.

Cheers
« Last Edit: July 20, 2008, 06:54:35 am by hetman » Logged
hetman
Miner
**
Posts: 17


« Reply #8 on: July 20, 2008, 11:50:29 am »

And another problem. The patch was being cut-off at 64kB when I uploaded it in plain text. I've uploaded it again but in a zip archive this time so it's complete.
Logged
Pvt_Ryan
Master Jeweller
******
Posts: 422



WWW
« Reply #9 on: July 20, 2008, 12:03:24 pm »

Ahh
I never saw your update as I was looking at the last post to see if it had been updated..

Sorry for the delay.
Logged
Pvt_Ryan
Master Jeweller
******
Posts: 422



WWW
« Reply #10 on: July 20, 2008, 12:11:38 pm »

Quote
For generality the variable options in the SPC file are now: $VARIABLEnPREFIX, $VARIABLEnENCLOSEDBY, $SPECIALVARIABLEnCHARS with n = 1-3 . I've kept the old style numberless options so we don't break all the already present syntax files.

I would purpose a slight change here:
Either
1. Update ALL the spc files to use $VARIABLE1PREFIX instead of $VARIABLEPREFIX then remove $VARIABLEPREFIX.
OR
2. Remove $VARIABLE1PREFIX and take it as given that $VARIABLEPREFIX is its equlivent.

Personally I prefer option1 as it's more consistant, I'll add more ideas as they come to me..
Logged
hetman
Miner
**
Posts: 17


« Reply #11 on: July 21, 2008, 11:52:12 am »

Figured it might be a good idea to dump this in here too:

Yeh, I was thinking ultimately option 1 would be ideal.

The only place where this needs to change in the source code is in cedtElement.cpp (literally just remove the relevant line per spc argument), so I think for the sake of tractability it might not be a bad idea to check in the syntax file changes in a seperate revision. Theoretically it's just a simple file search/replace so nothing *should* go wrong... but there's not real tradeoffs for being careful here.
Logged
pn8830
Global Moderator
Jeweller
*****
Posts: 252



« Reply #12 on: July 29, 2008, 02:39:33 pm »

Wouldn't option 1 make old syntax files incompatible?
PN
Logged

Entities should not be multiplied beyond necessity
hetman
Miner
**
Posts: 17


« Reply #13 on: July 29, 2008, 02:42:14 pm »

Yeh, it's a big change. They could all be fixed with a search and replace on all the *.spc files. Nothing too serious, but serious enough to be left for a seperate commit I think.
Logged
pn8830
Global Moderator
Jeweller
*****
Posts: 252



« Reply #14 on: July 29, 2008, 08:01:47 pm »

I was a little concern if somebody uses own syntax files. Will this break them? We can change our files, that is easy.
PN
Logged

Entities should not be multiplied beyond necessity
Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.084 seconds with 18 queries.