0

my DSL grammer look like (only necessary part is displayed )

assemblerProgram: // standard way of defining model
content += CommandLine+
;

CommandLine: 
ControlInstructions | Pointaddress ;

Pointaddress:
name = POINTINGADD

terminal POINTINGADD:('_')('a'..'z'|'A'..'Z')? ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;

where POINTINGADD is a terminal rule which say that name should starts with "_".

Now I want to implement a quick fix for this terminal rule. is it possible? and which path should I follow?

thanks in advance.

6
  • Except for the missing semi-colon in line 8 I can't see a problem that needs to be fixed?
    – JensG
    Jun 12, 2015 at 7:49
  • what i exactly want is, whenever I enter a word without underscore it should provide a quick fix, the same name starting with underscore
    – Mohsin
    Jun 12, 2015 at 7:50
  • Ah, that one. I see.
    – JensG
    Jun 12, 2015 at 7:52
  • Do you have any idea which way to go?
    – Mohsin
    Jun 12, 2015 at 8:19
  • in this case you would loosen the terminal rule to leave out the underscore and add a semantic validation for the name + a quickfix. Jun 13, 2015 at 19:22

1 Answer 1

0

If you want to implement a "semantic" quickfix (i.e., one that operates on the model rather than on text), it's probably better to have a more lenient grammar, which does accept names without the leading underscore, then create a validation that complains about this and assigns a specific error code, which can finally be used to trigger the quickfix.

Alternatively, when dealing with syntax errors indeed, the documentation recommends to use ISyntaxErrorMessageProvider, but I haven't yet used this approach.

1
  • I have implemented the first technique and its working. the second technique looks like cumbersome, so i didn't apply that. Thanks alot.
    – Mohsin
    Jun 15, 2015 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.