jEdit Community - Resources for users of the jEdit Text Editor
RegEx in UnrealScript EditMode
Submitted by MonsOlympus on Sunday, 22 May, 2011 - 15:46
Okay so Ive been at this for a good week trying to work things out, using regex buddy for testing against java but it seems the version that it uses is different than what the jedit modes use.

Now my issue is in matching braces, now I have seen that this can be tricky using regex and perhaps using some other method might be the go but Im not even sure where to start there. I am willing to try anything even if it includes having to write a plugin or extending jedits functionality as this might head in that direction at some point.

Ive tried various regex's to try and match the cpptext blocks, now to explain it, cpptext blocks are C++ written inside UnrealScript source and Im wanting to highlight them as C++ by importing parts of that mode in instead of adding the keywords in the UnrealScript list. The reason for this is UnrealScript while sharing similarities to C++ doesnt allow the use of keywords such as void, null or virtual for instance.

As an example:

class foo extends bar;

var newfoo newb;

cpptext
{
virtual void BeginDestroy();
virtual UBOOL IsReadyForFinishDestroy();

UBOOL IsHiddenEdAtStartup() const
{
return bHiddenEd;
}
}

Which shouldnt be that hard to do since the braces are always matched and cpptext resides outside any nest. The tricky part is there is also structcpptext which resides in 1 nest always and can contain nested braces but each only contain a nest depth of one, being functions/constructors.

Any help would be greatly appreciated because at this point I feel like Im bangin my head against a wall. Thanks.
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
I guess You're thinking of "D
by Robert Schwenn on Sun, 22/05/2011 - 17:22
I guess You're thinking of "DELEGATE" sections as in html mode file.

You have these problems Eye-wink
1. When using "SPAN_REGEXP" to determine a section You need uniqe begin and end strings. Begin would be "cpptext", but the end?
2. When using "SEQ_REGEXP" You have to provide a Regular Expression to match the whole C++ section, but (from User's Guide) "The regular expression match cannot span more than one line".

I'd think You should tell Your problem (and will for doing the patch) at the devel mailing list ( https://lists.sourceforge.net/lists/listinfo/jedit-devel ).

Robert
 
Thanks for the reply Robert,
by MonsOlympus on Sun, 22/05/2011 - 17:40
Thanks for the reply Robert, delegate is indeed what Im using then importing parts of the c++ mode in there (which itself imports part of the c mode). I didnt realize Seq_RegExp only covers one line so that explains why regexBuddy is telling me it should work and why its not working in jedit.

I know jedit now uses the java library as I read in the documentation so I was lost as to why it wasnt working, I must have brushed over reading about how spans are only allowed for the span tags and not the sequence.

I was wondering why I couldnt get anything past the \{ to highlight in the cpp using seq and I knew that the span end wasnt allowed to have a full regex since anything other than } wasnt working.
User login
Browse archives
« November 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300