Alf verifier or validator [message #1362673] |
Sat, 17 May 2014 19:33 |
John Smith Messages: 12 Registered: March 2014 |
Junior Member |
|
|
Dear All,
Is there any way to programmatically execute the Alf syntax verifier on a specified .alf file (resource)?
I need to do formal model transformation from an .alf file, and I have to make sure, that the .alf file was syntactically valid.
Moreover, is there a way to execute the verifier, and receive a boolean value, indicating that the specified .alf file was syntactically valid?
Thank you for your help in advance!
Best regards,
John
[Updated on: Sun, 18 May 2014 13:59] Report message to a moderator
|
|
|
Re: Alf verifier or validator [message #1364255 is a reply to message #1362673] |
Sun, 18 May 2014 11:51 |
John Smith Messages: 12 Registered: March 2014 |
Junior Member |
|
|
I have found the org.eclipse.papyrus.uml.alf.validation.AlfJavaValidator class which may be responsible for the syntax validation. (Source: http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/plain/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java)
How can I access that class? Which Eclipse Papyrus Alf plug-in contains it?
Moreover, which plug-ins contain those classes, that AlfJavaValidator requires?
Edit: I have found the answer: org.eclipse.papyrus.uml.alf containts that class, that is in the Papyrus UML (Incubation) project.
Question: As far as I have seen, the AlfJavaValidator does not check the syntax of the statements. For instance, if I write
let a^someting : Integer = 0
then the syntax highlighter marks the line, as it is incorrect, because of the ^ character. How can I reach that class or method that is responsible for this syntax check?
Thank you for your help!
Best regards,
John
[Updated on: Sun, 18 May 2014 13:59] Report message to a moderator
|
|
|
Re: Alf verifier or validator [message #1366694 is a reply to message #1364255] |
Mon, 19 May 2014 12:32 |
John Smith Messages: 12 Registered: March 2014 |
Junior Member |
|
|
Solution:
Resource original = (org.eclipse.emf.ecore.resource.Resource) resource;
if(original.getErrors().size() != 0 || original.getWarnings().size() != 0 || Diagnostician.INSTANCE.validate(resource.getContents().get(0)).getSeverity() != Diagnostic.OK){
// input invalid
} else {
// input valid
}
[Updated on: Mon, 19 May 2014 12:34] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.76653 seconds