need hint regarding 'parsability' [message #610480] |
Tue, 21 September 2010 16:54  |
Eclipse User |
|
|
|
Hi,
I have an issue in b3 regarding value conversion. When versions are
entered, they can be entered without escapes or quotes and they are
transformed into instances of Version and VersionRange (as used by p2).
Example: 1.0.0.v201008123456790
If the version contains 'odd characters' or 'keywords' the version is
entered as a String. Example "1.0.0.ouch_if".
When converting a Version value back, I would like to know if it will
require quoting or not. Is there a way to check if the grammar would
accept the unquoted string?
Regards
- henrik
|
|
|
|
|
|
|
|
Re: need hint regarding 'parsability' [message #626239 is a reply to message #625820] |
Wed, 22 September 2010 09:05  |
Eclipse User |
|
|
|
And - it works like a charm!!
Exactly what I wanted. Thanks for the hint Sebastian.
Regards
- henrik
On 9/22/10 12:27 PM, Henrik Lindberg wrote:
> Sorry about the noise - the method *is* public in the parser generated
> for the grammar - only a cast was required.
>
> Duh...
> - henrik
>
> On 9/22/10 11:44 AM, Henrik Lindberg wrote:
>> The method mentioned is protected in the generated parser, so I guess I
>> have to derive a new class that exposes this functionality - i.e.
>>
>> protected IParseResult parse(String ruleName, CharStream in)
>>
>> Regards
>> - henrik
>>
>> On 9/22/10 10:43 AM, Sebastian Zarnekow wrote:
>>> Hi Henrik,
>>>
>>> you could try something like this:
>>>
>>> @Inject
>>> IParser parser;
>>>
>>> IParseResult result = parser.parse(grammarAccess.getVersion().getName(),
>>> new StringReader("1.0.0.foo_if"));
>>>
>>> The result should contain information about the syntax errors.
>>>
>>> Regards,
>>> Sebastian
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04423 seconds