Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Buckminster » How to deal with partitions when partition is not terminal
How to deal with partitions when partition is not terminal [message #652311] Thu, 03 February 2011 14:38 Go to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Hi,
The implementation of ITokenTypeToPartitionTypeMapper
creates text partitions based on lexer tokens (i.e. for comments or
strings). My strings are not a single terminal and are instead handled
as data type rules.

I created my own implementation of ITokenTypeToPartitionTypeMapper and
by marking all parts included in strings (except WS) auto edits work a
lot better. I would however like to protect against insertion of ML
comments when seeing /* in a string even if caret is after a WS in the
string.

I am wondering if I can assume that the #getPartitionType(int
antlrToken) will be called with *all* tokens thus making it possible to
detect the start and end of strings. However since the default
implementation of ITokenTypeToPartitionTypeMapper is marked as
@Singleton it makes me wonder if it is possible to maintain state.
If I mark it as a non singleton, will it be recreated lots and lots of
times? etc.

Any other suggestions how to handle non terminal string partitions?

Regards
- henrik
Re: How to deal with partitions when partition is not terminal [message #652413 is a reply to message #652311] Thu, 03 February 2011 19:06 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Sorry, obviously sent to the wrong forum :)
Now reposted where it was supposed to be sent... (tmf).

Sorry for the noise...
- henrik

On 2/3/11 3:38 PM, Henrik Lindberg wrote:
> Hi,
> The implementation of ITokenTypeToPartitionTypeMapper
> creates text partitions based on lexer tokens (i.e. for comments or
> strings). My strings are not a single terminal and are instead handled
> as data type rules.
>
> I created my own implementation of ITokenTypeToPartitionTypeMapper and
> by marking all parts included in strings (except WS) auto edits work a
> lot better. I would however like to protect against insertion of ML
> comments when seeing /* in a string even if caret is after a WS in the
> string.
>
> I am wondering if I can assume that the #getPartitionType(int
> antlrToken) will be called with *all* tokens thus making it possible to
> detect the start and end of strings. However since the default
> implementation of ITokenTypeToPartitionTypeMapper is marked as
> @Singleton it makes me wonder if it is possible to maintain state.
> If I mark it as a non singleton, will it be recreated lots and lots of
> times? etc.
>
> Any other suggestions how to handle non terminal string partitions?
>
> Regards
> - henrik
Previous Topic:Problem signing jar locally with custom keystore
Next Topic:NullPointerException in GenericSession
Goto Forum:
  


Current Time: Fri Mar 29 00:31:17 GMT 2024

Powered by FUDForum. Page generated in 0.02376 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top