Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [TCS] dc#title going in "dc#title" going out
[TCS] dc#title going in "dc#title" going out [message #25787] Sat, 10 January 2009 17:31 Go to next message
Eclipse UserFriend
Hi eclipse.modeling.tmf group.

Sorry for yet a question but I am still struggling with using TCS with my
DSL.

In my sample file I have such a statement:

sharedVariables {?response, ?output}

But after doing a quick "Inject WSMO File to WSMO Model" and then "Extract
WSMO Model to WSMO File (.wsml)" it comes out like:

sharedVariables {"?response", "?output"}

I don't need or want these double-quotes on the output. I did have to add
a |'?' to the %protected ALPHA in the lexer to get it to recognize ? at
all within strings - and same for # which occurs in some of my strings. I
know I can just move ? to the syntax but this occurs elsewhere with other
symbols within the middle of strings so is a larger issue I need to
address.

For instance, I have some attributes with # in middle of the string (e.g.
dc#title or dc#contributor) and TCS also places double-quotes around those
strings on output.

Is there anything systematic I can do to stop this from occurring?

Jeff
Re: [TCS] dc#title going in "dc#title" going out [message #25907 is a reply to message #25787] Tue, 13 January 2009 05:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jeff,

There are two possibilities:
- Adding the ? explicitly in the TCS template like:
"?" varName
- Or keeping it as part of the name (as you have now) but then you have
to give the identEsc="" param to the extractor. Note that this cannot
currently be done using the menu action, but you can do it if you
extract using an ant script (and of course from Java code). Note also
that this solution should also solve the problem of identifiers with #
in the middle.


Regards,

Frédéric Jouault

J Rusk a écrit :
> Hi eclipse.modeling.tmf group.
>
> Sorry for yet a question but I am still struggling with using TCS with
> my DSL.
> In my sample file I have such a statement:
>
> sharedVariables {?response, ?output}
>
> But after doing a quick "Inject WSMO File to WSMO Model" and then
> "Extract WSMO Model to WSMO File (.wsml)" it comes out like:
>
> sharedVariables {"?response", "?output"}
>
> I don't need or want these double-quotes on the output. I did have to
> add a |'?' to the %protected ALPHA in the lexer to get it to recognize ?
> at all within strings - and same for # which occurs in some of my
> strings. I know I can just move ? to the syntax but this occurs
> elsewhere with other symbols within the middle of strings so is a larger
> issue I need to address.
> For instance, I have some attributes with # in middle of the string
> (e.g. dc#title or dc#contributor) and TCS also places double-quotes
> around those strings on output.
>
> Is there anything systematic I can do to stop this from occurring?
>
> Jeff
>
Re: [TCS] dc#title going in "dc#title" going out [message #26029 is a reply to message #25907] Tue, 13 January 2009 16:39 Go to previous messageGo to next message
Eclipse UserFriend
But I guess if I pass the <param name="identEsc" value=""/> parameter to
the extractor it would avoid using double-quotes on all strings, correct?
Even those for other attributes, some with spaces, where the double-quotes
are acceptable, or even necessary (and exist in the input samples)?

In my DSL, there are only two types of strings with this issue, the
examples are ?string (variable) and stringA#stringB (CompactURI), which I
need to treat as simple strings, where the show up, not to be delimited by
double-quotes. Basically, I'd prefer if TCS would consider ? and # as
just plain alpha characters in a string. Is there possibly a solution
using tokens?

Jeff

Frédéric Jouault wrote:

> Hi Jeff,

> There are two possibilities:
> - Adding the ? explicitly in the TCS template like:
> "?" varName
> - Or keeping it as part of the name (as you have now) but then you have
> to give the identEsc="" param to the extractor. Note that this cannot
> currently be done using the menu action, but you can do it if you
> extract using an ant script (and of course from Java code). Note also
> that this solution should also solve the problem of identifiers with #
> in the middle.
Re: [TCS] dc#title going in "dc#title" going out [message #26070 is a reply to message #26029] Thu, 15 January 2009 07:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I see your point: the extractor should take into account the lexer.
Please, open a bug for this.

That being said, I believe your problem can be easily solved:
- Use stringSymbol for every string that must be quoted (you may need to
change the lexer so that double quotes are used for strings, and not for
identifiers).
- Use identifier for strings that must not be quoted, and pass <param
name="identEsc" value=""/> to the extractor.

Alternatively, you could extract the "?" from the identifier (as I
mentioned in my previous reply), and consider stringA#stringB as:
uri "#" fragment
with stringA and stringB in separate attributes.


Regards,

Frédéric Jouault


J Rusk a écrit :
> But I guess if I pass the <param name="identEsc" value=""/> parameter to
> the extractor it would avoid using double-quotes on all strings,
> correct? Even those for other attributes, some with spaces, where the
> double-quotes are acceptable, or even necessary (and exist in the input
> samples)?
> In my DSL, there are only two types of strings with this issue, the
> examples are ?string (variable) and stringA#stringB (CompactURI), which
> I need to treat as simple strings, where the show up, not to be
> delimited by double-quotes. Basically, I'd prefer if TCS would consider
> ? and # as just plain alpha characters in a string. Is there possibly a
> solution using tokens?
>
> Jeff
>
> Frédéric Jouault wrote:
>
>> Hi Jeff,
>
>> There are two possibilities:
>> - Adding the ? explicitly in the TCS template like:
>> "?" varName
>> - Or keeping it as part of the name (as you have now) but then you
>> have to give the identEsc="" param to the extractor. Note that this
>> cannot currently be done using the menu action, but you can do it if
>> you extract using an ant script (and of course from Java code). Note
>> also that this solution should also solve the problem of identifiers
>> with # in the middle.
>
>
>
Re: [TCS] dc#title going in "dc#title" going out [message #26111 is a reply to message #26070] Thu, 15 January 2009 14:37 Go to previous message
Eclipse UserFriend
Thanks very much. I'll give that a try.

Jeff


Frédéric Jouault wrote:

> Hi,

> I see your point: the extractor should take into account the lexer.
> Please, open a bug for this.

> That being said, I believe your problem can be easily solved:
> - Use stringSymbol for every string that must be quoted (you may need to
> change the lexer so that double quotes are used for strings, and not for
> identifiers).
> - Use identifier for strings that must not be quoted, and pass <param
> name="identEsc" value=""/> to the extractor.

> Alternatively, you could extract the "?" from the identifier (as I
> mentioned in my previous reply), and consider stringA#stringB as:
> uri "#" fragment
> with stringA and stringB in separate attributes.


> Regards,

> Frédéric Jouault
Previous Topic:[TCS] Problems with "Loading outline
Next Topic:Serialize (pretty-print) - Xtext or TCS?
Goto Forum:
  


Current Time: Fri May 09 17:11:45 EDT 2025

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

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

Back to the top