Welcome,
Guest
. Please
login
or
register
.
September 07, 2010, 07:46:35 am
HippoEDIT - Programmers text editor
General Category
Syntax Files
(Moderators:
alex
,
Stefan
)
Help on "regular expressions" in syntax definition files
« previous
next »
Pages:
[
1
]
2
Author
Topic: Help on "regular expressions" in syntax definition files (Read 515 times)
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Help on "regular expressions" in syntax definition files
«
on:
May 04, 2010, 03:10:44 pm »
Hi.
Is there any help file on how to use regular expressions in HippoEDIT's syntax defining files?
How can I define a style for blocks beginning with "fnx." where x is any integer e.g.?
And isn't there any keyword similar to "noneof" used in
<Block open="0x">
<Close noneof="0-9A-Fa-f"/>
</Block>
e.g. but meaning "any of"?
And how can the "noneof" keyword be used to specify the
opening
, not closing character sequence of a block?
And a question more, just to be sure: isn't there a file defining syntax (highlighting) for markdown or textile?
«
Last Edit: May 04, 2010, 03:27:55 pm by cichlasoma
»
Logged
alex
Developer
Global Moderator
Hero Member
Karma: +19/-2
Offline
Gender:
Posts: 1334
Re: Help on "regular expressions" in syntax definition files
«
Reply #1 on:
May 04, 2010, 05:39:00 pm »
Hi cichlasoma,
welcome on forum.
Hm.. I thought that I have already described this in FAQ, but found that not. So
I have extended syntax definition explanation
.
You will find there answers to your questions in Blocks section.
Hippoedit does not support regular expressions in syntax definitions yet, only in labels. And only fixed open tags are supported.
So, the only way I see to achieve what you what you want will be to define all variations. Or define block startting with
fn
and close with
<Close noneof="0-9"/>.
Best regards,
Alex.
Logged
HippoEDIT team
http://www.hippoedit.com/
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Re: Help on "regular expressions" in syntax definition files
«
Reply #2 on:
May 04, 2010, 07:40:46 pm »
Hi Alex!
Thank you very much for your answer and for the FAQ extension!
Quote from: alex on May 04, 2010, 05:39:00 pm
Or define block startting with
fn
and close with
<Close noneof="0-9"/>.
As for your suggestion quoted, I don't get it - could it really work as a definition of a block starting with "fn[integer]." (note the period) and ending with newline e.g. (which is how footnotes in textile are defined)?
Kind regards,
c.
Logged
alex
Developer
Global Moderator
Hero Member
Karma: +19/-2
Offline
Gender:
Posts: 1334
Re: Help on "regular expressions" in syntax definition files
«
Reply #3 on:
May 04, 2010, 11:55:18 pm »
... :/ No. Will not work.
You want to have
dynamic
start tag, which is not supported yet..
Even for close tag it is not possible, because regular expressions are not supported.
I am planning to add support of the regular expressions for highlighting, but do not know when.
Main problem with them is in times slower parsing performance and effort of integrating in current infrastructure.
The only one ugly way I can suggest here is to define explicit style for every footnote, as:
<Block open="fn0." close="\n"/>
<Block open="fn1." close="\n"/>
<Block open="fn2." close="\n"/>
etc...
Logged
HippoEDIT team
http://www.hippoedit.com/
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Re: Help on "regular expressions" in syntax definition files
«
Reply #4 on:
May 05, 2010, 09:25:36 am »
alex: Thank you!
«
Last Edit: May 05, 2010, 09:29:37 am by cichlasoma
»
Logged
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Re: Help on "regular expressions" in syntax definition files
«
Reply #5 on:
May 05, 2010, 11:00:23 am »
I'd have two questions more:
1) Is there a way how to define a block closing with two EOLs ( <Block open="fn1" close="\n\n"/> does not work.)
2) How to define alternative
closing
strings of a block?
Whereas
<Style id="heading1" name="Heading1" text="1" bold="1" italic="0" underline="1" bkclr="#FFFFFFFF">
<Blocks>
<Block open="h1. " close="\n"/>
<Block open="h1{" close="\n"/>
</Blocks>
</Style>
does work for alternative opening strings,
<Style id="link" name="Link" text="1" bold="0" italic="1" underline="1" clr="#FF99CC" bkclr="#FFFFFFFF">
<Blocks>
<Block open="aa" close="\n"/>
<Block open="aa" close=" "/>
</Blocks>
</Style>-->
does not work for closing ones.
Logged
alex
Developer
Global Moderator
Hero Member
Karma: +19/-2
Offline
Gender:
Posts: 1334
Re: Help on "regular expressions" in syntax definition files
«
Reply #6 on:
May 05, 2010, 11:14:55 am »
1) No. There is not such way. \n is not a real check for \n in text (you can have different line break styles in same document), but just indicator to engine that parsing is till end of the line. HippoEDIT does here not a stream text processing, but by line processing.
2) Yes. You can define alternative close tags like this:
Code:
<Block open="aaa" close="bbb">
<Close text="ddd"/>
<Close text="\n"/>
<Close anyof="db"/>
</Block>
but I think, by design, your way should also work...
If not, I can assume it as a bug, and will fix in next 1.49 beta.
Can you paste here some example of the text you want to highlight? Than maybe I will suggest how to process in a better way, using what is possible in HE now and what is planned.
Logged
HippoEDIT team
http://www.hippoedit.com/
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Re: Help on "regular expressions" in syntax definition files
«
Reply #7 on:
May 05, 2010, 12:13:21 pm »
alex: Thanks!
Yes, I it seems to me to be a bug as well... Sometimes, HE takes the first ending to be the valid one, sometimes the second one, I cannot figure out what's going on.
Another syntax definition files related bug I believe to have found is that following three styles are rendered in the same color for me. When I choose any other colors than shades of green, it works, but with kinds of green it doesn't.
<Style id="bulletedListLevel1" name="bulletedListLevel1" text="1" bold="1" italic="0" underline="0" clr="#339900" bkclr="#FFFFFFFF">
<Blocks>
<Block open="* " close="\n"/>
</Blocks>
</Style>
<Style id="bulletedListLevel2" name="BulletedListLevel2" text="1" bold="1" italic="0" underline="0" clr="#66CC33" bkclr="#FFFFFFFF">
<Blocks>
<Block open="** " close="\n"/>
</Blocks>
</Style>
<Style id="bulletedListLevel3" name="bulletedListLevel3" text="1" bold="1" italic="0" underline="0" clr="#99FF66" bkclr="#FFFFFFFF">
<Blocks>
<Block open="*** " close="\n"/>
</Blocks>
</Style>
As for defining alternative closings in the way you suggest - it works, thanks.
(I used it for the following:
<Style id="link" name="Link" text="1" bold="0" italic="1" underline="1" clr="#FF99CC" bkclr="#FFFFFFFF">
<Blocks>
<Block open="":http://" close="\n">
<Close text=" "/>
</Block>
</Blocks>
</Style>
which is not perfect way of highlighting links in textile, but it works somehow.
(The syntax is
"linktext":http://… )
Kind regards,
c.
«
Last Edit: May 05, 2010, 12:15:00 pm by cichlasoma
»
Logged
alex
Developer
Global Moderator
Hero Member
Karma: +19/-2
Offline
Gender:
Posts: 1334
Re: Help on "regular expressions" in syntax definition files
«
Reply #8 on:
May 05, 2010, 01:36:27 pm »
Ok, I will check with alternative closing.
About problem with colors, check user file for your schema (it created automatically), it can also contain colors for your styles (when they changed through UI) and have priority over settings in spec file.
Also try to use palette colors if possible, otherwise it will be not possible to use your schema with non default color schemes.
About link highlighting: check def_spec.file, you can control where (in which container/style) allowed, and maybe reuse. You can also import definitions to your style.
Logged
HippoEDIT team
http://www.hippoedit.com/
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Re: Help on "regular expressions" in syntax definition files
«
Reply #9 on:
May 05, 2010, 02:10:16 pm »
alex: As for "green issue", it happens without any user file as well. (And if it were caused by a user file, other colors in the styles definitions would not be reflected as well, IMHO. But if I set other colors than shades of green, it works. (Really strange...)
As for "palette colors" and "non default color schemes", couldn't you be more explicit or give me a link to some explanatory docs? (I have no idea what you are talking about... :-( )
Logged
alex
Developer
Global Moderator
Hero Member
Karma: +19/-2
Offline
Gender:
Posts: 1334
Re: Help on "regular expressions" in syntax definition files
«
Reply #10 on:
May 05, 2010, 03:15:05 pm »
Hm... I never got report like this, so i think there is some error in your schema file
When I wrote
user file
, I mean xxx_user.xml, where xxx is name of your syntax. It created always, if you change settings for syntax from UI, and has copy of all default settings.
If you are sure that it not like this, send me your file to supportbox hippoedit com, I will check.
Normally (in default syntax schemes), colors are defined not explicitly (as #FFAAFF) but with referring to some
named color
from active palette:
Code:
<Style id="search_result" name="Search Result" bold="2" italic="2" underline="2" clr="#FFFFFFFF" bkclr="Search Result" overview="1"/>
Here
Search Result
is named color, from current palette. Check \data\colors\color_default.xml for complete list. All color schemes (palettes) should have same named color set, and in this case, when you switch color scheme in HippoEDIT UI, you will not get situation when you have black background and black text.
Logged
HippoEDIT team
http://www.hippoedit.com/
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Re: Help on "regular expressions" in syntax definition files
«
Reply #11 on:
May 05, 2010, 03:56:29 pm »
Quote from: alex on May 05, 2010, 03:15:05 pm
Hm... I never got report like this, so i think there is some error in your schema file
If I paste the lines I posted into the python_spec.xml, thus adding three new styles to Python's syntax, it behaves just like in my own definition file (All the sthree styles are disploeyed in the same colour (although in Syntax settings/Fonts and colors, different colors are shown for them, BTW)). Therefore, it doesn't seem to be a problem of my file... I am going to send you the modified python_spec.xml to avoid any confusion.
Quote
When I wrote
user file
, I mean xxx_user.xml, where xxx is name of your syntax. It created always, if you change settings for syntax from UI, and has copy of all default settings.
If you are sure that it not like this, send me your file to supportbox hippoedit com, I will check."
(I know what you meant by "user file" - it happens also when I remove the xxx_user.xml file.)
Quote
Normally (in default syntax schemes), colors are defined not explicitly (as #FFAAFF) but with referring to some
named color
from active palette:
Code:
<Style id="search_result" name="Search Result" bold="2" italic="2" underline="2" clr="#FFFFFFFF" bkclr="Search Result" overview="1"/>
Here
Search Result
is named color, from current palette. Check \data\colors\color_default.xml for complete list. All color schemes (palettes) should have same named color set, and in this case, when you switch color scheme in HippoEDIT UI, you will not get situation when you have black background and black text.
Thank you for the explanation. :-)
«
Last Edit: May 05, 2010, 03:58:46 pm by cichlasoma
»
Logged
alex
Developer
Global Moderator
Hero Member
Karma: +19/-2
Offline
Gender:
Posts: 1334
Re: Help on "regular expressions" in syntax definition files
«
Reply #12 on:
May 05, 2010, 04:10:45 pm »
Ok, I have tried and know the reason.
The contrast between color you have selected for text is not enough for white (default) background.
The ration should be at lease 5:1 default (UI standards). Otherwise editor will optimize it (what has happened).
To see your explicit colors, go to Tools->Color Schemes->Contrast and set it to
Do not Change
.
Logged
HippoEDIT team
http://www.hippoedit.com/
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Re: Help on "regular expressions" in syntax definition files
«
Reply #13 on:
May 05, 2010, 04:25:38 pm »
alex: Ufff!!!!
Thank you!!!
Logged
cichlasoma
Jr. Member
Karma: +0/-0
Offline
Posts: 87
Re: Help on "regular expressions" in syntax definition files
«
Reply #14 on:
May 05, 2010, 05:11:07 pm »
(alex: BTW, I'd find it really nice if a user were reminded by HE that some color was "blocked" when it happens...)
Logged
Pages:
[
1
]
2
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> General Discussion
=> FAQ
=> Feature requests and suggestions
===> Implemented
=> Add-ons, Tools, Plugins
=> Scripting, Scripts and Macros
=> Syntax Files
=> HippoEDIT vs Other text editors
=> Bug reports
===> Solved
=> Beta Version Test
===> Released
-----------------------------
Deutsche Unterstützung - German Support
-----------------------------
=> Allgemeine Fragen
-----------------------------
Русская Поддержка - Russian Support
-----------------------------
=> Общие вопросы
Powered by SMF 1.1.11
|
SMF © 2006-2009, Simple Machines LLC
Loading...