Compilation error inside the grammar access class when upgrading to Xtext 2.14 [message #1790666] |
Thu, 14 June 2018 07:54 |
|
Dear all.
When trying to upgrade Xtext from 2.13 to 2.14, I'm encountering compilation errors within the generated code of my language grammar access class.
In the file SARLGrammarAccess.java (SARL is the name of my language), the following lines has an error:
private final XtendGrammarAccess gaXtend;
//MultiTypeReference types::JvmTypeReference:
// JvmTypeReference ({types::JvmSynonymTypeReference.references+=current} ('|' references+=JvmTypeReference)+)?;
public XtendGrammarAccess.MultiTypeReferenceElements getMultiTypeReferenceAccess() {
return gaXtend.getMultiTypeReferenceAccess();
}
The error is: "The method getMultiTypeReferenceAccess() is undefined for the type XtendGrammarAccess".
My grammar has nothing special except I extends and reuse part of the Xtend grammar. The header of my grammar is:
grammar io.sarl.lang.SARL with org.eclipse.xtend.core.Xtend
generate sarl "http://www.sarl.io/lang/SARL"
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvm
import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase
import "http://www.eclipse.org/xtext/xbase/Xtype" as xtype
import "http://www.eclipse.org/xtend" as xtend
For generating the code, I use a MWE2 script that a part of is below :
component = XtextGenerator auto-inject {
// Generation and configuration module for SARL
configuration = SarlGeneratorModule {
// Project configuration
project = StandardProjectConfig auto-inject {
runtime = auto-inject {
enabled = true
name = runtimeProjectName
}
eclipsePlugin = auto-inject {
enabled = true
name = uiProjectName
}
genericIde = auto-inject {
enabled = true
name = uiProjectName
}
runtimeTest = auto-inject {
enabled = true
root = testProjectPath
}
eclipsePluginTest = auto-inject {
enabled = true
root = testUiProjectPath
}
mavenLayout = false
createEclipseMetaData = true
}
}
language = StandardLanguage auto-inject {
// Set of resources
resourceSet = XtextResourceSet : resourceSet {}
// SARL depends on the Xtend model
referencedResource = "platform:/resource/org.eclipse.xtend.core/model/Xtend.genmodel"
// ID for SARL
name = "io.sarl.lang.SARL"
// Pointer to the SARL grammar
grammarUri = "platform:/resource/${runtimeProjectName}/src/io/sarl/lang/SARL.xtext"
// Definition of the file extensions for SARL
fileExtensions = file.extensions
// Specification of the injection that is used by MWE2 (not by the SARL compiler)
guiceModule = SarlLanguageGeneratorModule {}
// Specify the grammar access fragment
grammarAccess = auto-inject {
}
// Lexer
parserGenerator = auto-inject {
removeBacktrackingGuards = true
lookaheadThreshold = '5'
partialParsing = true
debugGrammar = false
options = auto-inject {
//backtrack = true
}
}
// EMF Generator
emfGenerator = auto-inject {
// Do not update the build.properties in order to avoid the path "model/generated"
// within the "bin.includes" definition.
updateBuildProperties = false
}
// SARL Validator
validator = ValidatorFragment2 auto-inject {
composedCheck = "org.eclipse.xtend.core.validation.AnnotationValidation"
}
// SARL serializer
serializer = auto-inject {
generateStub = false
}
// Refactoring
renameRefactoring = auto-inject {
useJdtRefactoring = true
}
// Generates the required bindings only if the grammar inherits from Xbase
xbaseSupport = auto-inject {
generateXtendInferrer = false
}
// Testing infrastructure
junitSupport = auto-inject {
generateStub = false
}
// Content assist - Bug fixed for avoiding compilation error due to an
// invalid qualified name for the XtendProposalProvider
contentAssist = ContentAssistFragment2 auto-inject {
}
// Formatter - this fragment should be explicitly defined otherwise the SARLFormatter is not injected. Bug?
formatter = auto-inject {
generateStub = true
}
One strange thing is that the "MultiTypeReference" exists in the Xtend grammar 2.14, but the XtendGrammarAccess has no reference to this element.
What is going wrong?
Stéphane.
|
|
|
|
|
|
|
|
Re: Compilation error inside the grammar access class when upgrading to Xtext 2.14 [message #1790745 is a reply to message #1790696] |
Fri, 15 June 2018 12:48 |
|
Dear Christian.
I have create the issue https://github.com/eclipse/xtext-xtend/issues/474.
Dear Ed.
Within SARL, a part of the grammar is dedicated to object-oriented programming, the other part is dedicated to agent-oriented programming. This latest part is the one on which we want to work hard.
We have decided to not code from scratch a OOP infrastructure since Xtend already provides one that could be extended.
SARL language's grammar inherits from the Xtend grammar and changes several specific rules for fixing the syntax philosophy that is different between Xtend and SARL (so that Xtend is hidden to SARL users).
In this we, we have benefit of all the code that is written for Xtend (jvm model inferrer, validator, ...) at a lower cost than an implementation from scratch.
Since the works done on Xtend are of a very good quality, we think that it is not a huge problem to inherits from it (and we have given a proof of concept with the previous version of Xtend) and update our code when some part of Xtend has changed.
All the best.
Stéphane.
[Updated on: Fri, 15 June 2018 12:58] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04489 seconds