Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsei.unescapeString(getText(), 1)
https://www.eclipse.org/forums/index.php/mv/msg/8265/25331/#msg_25331
I have some strings delimited with double-quotes (eg. "string") and some
strings delimited by leading underscore and double quotes (eg. _"string").
I can add ('_\"' | '\"') to the NAME rule so the lexer can recognize both
strings but then the ei.unescapeString(getText(), 1) is a problem because
sometimes I need to escape just the double quotes and other times the
underscore and double-quotes.
Can anyone let me know how the unescapeString(String, int) method works
and how it may be used here or suggest another function which may deal
with this?
Thanks,
Jeff]]>J Rusk2009-01-04T22:41:15-00:00Re: ei.unescapeString(getText(), 1)
https://www.eclipse.org/forums/index.php/mv/msg/8265/25371/#msg_25371
Sven
J Rusk schrieb:
> Hi eclipse.modeling.tmf group.
>
> I have some strings delimited with double-quotes (eg. "string") and some
> strings delimited by leading underscore and double quotes (eg. _"string").
>
> I can add ('_\"' | '\"') to the NAME rule so the lexer can recognize
> both strings but then the ei.unescapeString(getText(), 1) is a problem
> because sometimes I need to escape just the double quotes and other
> times the underscore and double-quotes.
> Can anyone let me know how the unescapeString(String, int) method works
> and how it may be used here or suggest another function which may deal
> with this?
>
> Thanks,
>
> Jeff
>]]>Sven Efftinge2009-01-05T08:00:31-00:00[TCS] Re: ei.unescapeString(getText(), 1)
https://www.eclipse.org/forums/index.php/mv/msg/8265/25412/#msg_25412
Sven Efftinge wrote:
> I assume this question is dedicated to TCS, right?
> Sven
> J Rusk schrieb:
>> Hi eclipse.modeling.tmf group.
>>
>> I have some strings delimited with double-quotes (eg. "string") and some
>> strings delimited by leading underscore and double quotes (eg. _"string").
>>
>> I can add ('_"' | '"') to the NAME rule so the lexer can recognize
>> both strings but then the ei.unescapeString(getText(), 1) is a problem
>> because sometimes I need to escape just the double quotes and other
>> times the underscore and double-quotes.
>> Can anyone let me know how the unescapeString(String, int) method works
>> and how it may be used here or suggest another function which may deal
>> with this?
>>
>> Thanks,
>>
>> Jeff
>>]]>J Rusk2009-01-05T16:48:05-00:00Re:[TCS] ei.unescapeString(getText(), 1)
https://www.eclipse.org/forums/index.php/mv/msg/8265/25453/#msg_25453
works, but I don't think that you're trying to take the
correct approach.
As you have two different primitives, I think that you
need to declare two string primitiveTemplates. One of
these should be defined with the default keyword,
and will be called for most string type attributes in
your grammar. For string type attributes that need the
other syntax, use the "{as=xxx}" annotation on the
attribute name; where xxx is the name of your
non-default string primitiveTemplate.
I hope that this helps
Andy.
"J Rusk" <rusk@qiniq.com> wrote in message
news:8190d4c1599f5ad80a8260d6449b0b9a$1@www.eclipse.org...
> Hi eclipse.modeling.tmf group.
>
> I have some strings delimited with double-quotes (eg. "string") and some
> strings delimited by leading underscore and double quotes (eg. _"string").
>
> I can add ('_\"' | '\"') to the NAME rule so the lexer can recognize both
> strings but then the ei.unescapeString(getText(), 1) is a problem because
> sometimes I need to escape just the double quotes and other times the
> underscore and double-quotes.
> Can anyone let me know how the unescapeString(String, int) method works
> and how it may be used here or suggest another function which may deal
> with this?
>
> Thanks,
>
> Jeff
>]]>Andy Carpenter2009-01-06T09:20:09-00:00Re: [TCS] ei.unescapeString(getText(), 1)
https://www.eclipse.org/forums/index.php/mv/msg/8265/25646/#msg_25646
Would this work in situations where I do not know in advance which
primitiveTemplate would be required for a given attribute (i.e. could be
"string" or _"string" for a given attribute)?
Jeff
Andy Carpenter wrote:
> I can't tell you how the ei.unescapeString() function
> works, but I don't think that you're trying to take the
> correct approach.
> As you have two different primitives, I think that you
> need to declare two string primitiveTemplates. One of
> these should be defined with the default keyword,
> and will be called for most string type attributes in
> your grammar. For string type attributes that need the
> other syntax, use the "{as=xxx}" annotation on the
> attribute name; where xxx is the name of your
> non-default string primitiveTemplate.
> I hope that this helps
> Andy.]]>J Rusk2009-01-06T21:56:25-00:00Re: [TCS] ei.unescapeString(getText(), 1)
https://www.eclipse.org/forums/index.php/mv/msg/8265/25677/#msg_25677
The way that I'd handle this is by making the model
reflect more syntax than ideal by having an attribute
for each of the possible types. I'd then do an m2m
transformation to convert the 'syntactic' model into
a 'purer' form.
Andy.
"J Rusk" <rusk@qiniq.com> wrote in message
news:cc1870b08f6247196a9c1a7403770c72$1@www.eclipse.org...
> Thanks Andy. Very good point. I likely was heading in the wrong
> direction.
>
> Would this work in situations where I do not know in advance which
> primitiveTemplate would be required for a given attribute (i.e. could be
> "string" or _"string" for a given attribute)?
>
> Jeff
>
> Andy Carpenter wrote:
>
>> I can't tell you how the ei.unescapeString() function
>> works, but I don't think that you're trying to take the
>> correct approach.
>
>> As you have two different primitives, I think that you
>> need to declare two string primitiveTemplates. One of
>> these should be defined with the default keyword,
>> and will be called for most string type attributes in
>> your grammar. For string type attributes that need the
>> other syntax, use the "{as=xxx}" annotation on the
>> attribute name; where xxx is the name of your
>> non-default string primitiveTemplate.
>
>> I hope that this helps
>
>> Andy.
>
>
>]]>Andy Carpenter2009-01-09T12:34:50-00:00Re: [TCS] ei.unescapeString(getText(), 1)
https://www.eclipse.org/forums/index.php/mv/msg/8265/25706/#msg_25706
example that the different syntaxes ("string", _"string", or just string)
can show up within the same attribute, please see example below:
My basic problem is that any IRI can be abbreviated to a Compact URI. Full
IRI's are delimited with the symbols ' _" ' and ' " ' but Compact URI does
not require special delimiters.
I'm not sure where to go from here. Any thoughts?
Andy Carpenter wrote:
> Jeff,
> The way that I'd handle this is by making the model
> reflect more syntax than ideal by having an attribute
> for each of the possible types. I'd then do an m2m
> transformation to convert the 'syntactic' model into
> a 'purer' form.
> Andy.
> "J Rusk" <rusk@qiniq.com> wrote in message
> news:cc1870b08f6247196a9c1a7403770c72$1@www.eclipse.org...
>> Thanks Andy. Very good point. I likely was heading in the wrong
>> direction.
>>
>> Would this work in situations where I do not know in advance which
>> primitiveTemplate would be required for a given attribute (i.e. could be
>> "string" or _"string" for a given attribute)?
>>
>> Jeff
>>
>> Andy Carpenter wrote:
>>
>>> I can't tell you how the ei.unescapeString() function
>>> works, but I don't think that you're trying to take the
>>> correct approach.
>>
>>> As you have two different primitives, I think that you
>>> need to declare two string primitiveTemplates. One of
>>> these should be defined with the default keyword,
>>> and will be called for most string type attributes in
>>> your grammar. For string type attributes that need the
>>> other syntax, use the "{as=xxx}" annotation on the
>>> attribute name; where xxx is the name of your
>>> non-default string primitiveTemplate.
>>
>>> I hope that this helps
>>
>>> Andy.
>>
>>
>>]]>J Rusk2009-01-10T17:45:48-00:00Re: [TCS] ei.unescapeString(getText(), 1)
https://www.eclipse.org/forums/index.php/mv/msg/8265/25826/#msg_25826
Unfortunately, I'm usually oblivious to the simplest, most elegant
solution. Relevant additions to .tcs and .km3 below ...
In TCS:
template Full_IRI
: "_" <no_space> link
;
template Compact_IRI context
: link
;
template IRI abstract;
In KM3:
abstract class IRI extends LocatedElement {
attribute link : String;
}
class Full_IRI extends LocatedElement, IRI {}
class Compact_IRI extends LocatedElement, IRI {}]]>J Rusk2009-01-10T23:54:33-00:00