问题
I'm completely new to Xtext so thanks in advance for your help.
I have the following:
terminal PATTERN_SRC : STRING '.png';
Pattern: name='pattern:' value=PATTERN_SRC;
I want the user to code it like this:
pattern: (URL to image ending with .png / .jpg / .gif)
Currently I'm checking it like this but this does not work.
Is there a nice way to solve this? Thanks in advance!
回答1:
Sone remarks:
Don't use the feature name
. This is a reserved keyword for calculating unique names of an element in a resource.
STRING is like this: "Sometext".
So what you want is "somefile.png"
What you described is "somefile".png
You could just use STRING and implement a validation rule to ensure your URL is valid.
来源:https://stackoverflow.com/questions/58957140/xtext-check-whether-string-is-url