Pointers request for string-based microformat in DSL [message #1817054] |
Thu, 14 November 2019 18:27 |
Savas Parastatidis Messages: 3 Registered: November 2019 |
Junior Member |
|
|
Hi all,
I am new to xtext. I am looking for pointers to information about how to break down strings in my DSL within some context. I searched the Web but the closest I found was the templates-related grammar in Xtend. Unfortunately, I am trying to achieve something slightly different and I was unable to adapt the xtend grammar.
Here's a description of what I am trying to do...
// The argument is an ordinary string
call("i am an ordinary string")
// In the context of 'foo', the string takes special meaning
foo("I am a string with some {special parts | annotation variable} indicated by special characters").
In the context of foo, I'd like to extract "special parts", "annotation", and "variable".
// There can be multiple of these in a string
foor("Multiples { 1 | Int one} and { 2 | Double two } and { arbitrary text | String str}")
Should I be looking at writing some code?
Antlr has "modes" that allowed me to do this. What would be the equivalent for xtext?
I tried few things but, unfortunately, i keep getting ambiguity because of STRING. Even if I remove the dependency on Terminals, I get ambiguity with ID, which I need. The part that trips me is the text just after "{". Since it can be any arbitrary text and I have no special characters around it, the terminal for that part conflicts with ID.
Is there a write up about the strategy that I should follow?
Thank you,
.savas.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03341 seconds