Skip to main content



      Home
Home » Modeling » TMF (Xtext) » getting link name after link resolution failure
getting link name after link resolution failure [message #52248] Thu, 18 June 2009 16:48 Go to next message
Eclipse UserFriend
[I guess this falls in to the general "error recovery" theme... :)]

Suppose we've got this grammar and input:

Foo: 'foo' name=ID
Bar: 'bar' name=ID 'using' foo=[Foo] ;

bar MyBar using NoSuchFoo

Looks like MyBar.getFoo() would return a Foo, but there's no such Foo
named "NoSuchFoo." Presumably it returns null. Is there a way to fetch
the string "NoSuchFoo" from object MyBaz in this case?

Shane
Re: getting link name after link resolution failure [message #52356 is a reply to message #52248] Fri, 19 June 2009 01:23 Go to previous message
Eclipse UserFriend
Hi Shane,

You can get the string from the parse tree. I think what you want is
essentially a combination of what the methods NodeUtil#findNodesForFeature
and DefaultLinkingService#getCrossRefNodeAsString do. The former (static
method) gives you back a list of all parse tree nodes corresponding to the
given feature. (This list will contain a single value in the case of a
single valued feature.) The latter method (not static, so you may have to
copy it for now) extracts the string you want from a parse tree node. Note
that the latter method also depends on the Guice injected value converter
service.

In oAW there used to be a "parsedString" method for this purpose. I think
it would be a good idea to provide this as a utility in TMF Xtext. Could
you add an enhancement request to Bugzilla?

Cheers,

--knut


Shane Beasley wrote:

> [I guess this falls in to the general "error recovery" theme... :)]

> Suppose we've got this grammar and input:

> Foo: 'foo' name=ID
> Bar: 'bar' name=ID 'using' foo=[Foo] ;

> bar MyBar using NoSuchFoo

> Looks like MyBar.getFoo() would return a Foo, but there's no such Foo
> named "NoSuchFoo." Presumably it returns null. Is there a way to fetch
> the string "NoSuchFoo" from object MyBaz in this case?

> Shane
Previous Topic:I have a problem with grammar
Next Topic:New Xtext webpage
Goto Forum:
  


Current Time: Fri May 09 15:07:13 EDT 2025

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

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

Back to the top