项目:xtext-extras
文件:XtextAntlrGeneratorFragment.java
@Override
public void generate(Grammar grammar,XpandExecutionContext ctx) {
super.generate(grammar,ctx);
String srcGenPath = ctx.getoutput().getoutlet(Generator.SRC_GEN).getPath();
final String encoding = getEncoding(ctx,Generator.SRC_GEN);
String absoluteGrammarFileName = srcGenPath+"/"+getGrammarFileName(grammar,getNaming()).replace('.','/')+".g";
addAntlrParam("-fo");
addAntlrParam(absoluteGrammarFileName.substring(0,absoluteGrammarFileName.lastIndexOf('/')));
getAntlrTool().runWithEncodingAndParams(absoluteGrammarFileName,encoding,getAntlrParams());
Charset charset = Charset.forName(encoding);
simplifyUnorderedGroupPredicatesIfrequired(grammar,absoluteGrammarFileName,charset);
splitParserAndLexerIfEnabled(absoluteGrammarFileName,charset);
suppressWarnings(absoluteGrammarFileName,charset);
normalizeLineDelimiters(absoluteGrammarFileName,charset);
normalizetokens(absoluteGrammarFileName,charset);
}
项目:xtext-extras
文件:XtextAntlrUiGeneratorFragment.java
@Override
public void generate(Grammar grammar,ctx);
String srcUiGenPath = ctx.getoutput().getoutlet(Generator.SRC_GEN_IDE).getPath();
final String encoding = getEncoding(ctx,Generator.SRC_GEN_IDE);
String absoluteGrammarFileName = srcUiGenPath + "/" + getGrammarFileName(grammar,'/') + ".g";
addAntlrParam("-fo");
addAntlrParam(absoluteGrammarFileName.substring(0,getAntlrParams());
Charset charset = Charset.forName(getEncoding(ctx,Generator.SRC_GEN_IDE));
simplifyUnorderedGroupPredicatesIfrequired(grammar,charset);
removeBacktrackingGuardsIfEnabled(absoluteGrammarFileName,charset);
}
项目:xtext-extras
文件:ParseTreeConstructorFragment.java
@Override
public void generate(Grammar grammar,ctx);
if (generateDotDiagram || graphvizCommand != null) {
try {
TreeConstNFATodot ftd = new TreeConstNFATodot();
String fn = new File(ctx.getoutput().getoutlet(Generator.SRC_GEN).getPath() + "/"
+ getNaming().asPath(getParseTreeConstructorName(grammar,getNaming()))).getCanonicalPath();
if (generateDotDiagram) {
PrintStream out;
out = new PrintStream(fn + ".dot");
ftd.draw(grammar,out);
out.close();
}
if (graphvizCommand != null) {
String cmd = graphvizCommand.replace("%1",fn);
ftd.draw(grammar,cmd);
}
}
catch (IOException e) {
log.error("IOError",e);
}
}
}
项目:xtext-extras
文件:ExternalAntlrLexerFragment.java
@Override
public void generate(Grammar grammar,ctx);
String srcGen = Generator.SRC_GEN;
String src = Generator.SRC;
if (contentAssist || highlighting) {
srcGen = Generator.SRC_GEN_IDE;
src = Generator.SRC_IDE;
}
String srcGenPath = ctx.getoutput().getoutlet(srcGen).getPath();
String srcPath = ctx.getoutput().getoutlet(src).getPath();
String grammarFile = srcPath + "/" + getLexerGrammar().replace('.','/') + ".g";
String generateto = "";
if (lexerGrammar.lastIndexOf('.') != -1) {
generateto = lexerGrammar.substring(0,lexerGrammar.lastIndexOf('.'));
}
generateto = srcGenPath + "/" + generateto.replace('.','/');
addAntlrParam("-fo");
addAntlrParam(generateto);
final String encoding = getEncoding(ctx,srcGen);
getAntlrTool().runWithEncodingAndParams(grammarFile,getAntlrParams());
Charset charset = Charset.forName(encoding);
String javaFile = srcGenPath+"/"+getLexerGrammar().replace('.','/')+".java";
splitLexerIfEnabled(javaFile,charset);
suppressWarningsImpl(javaFile,charset);
normalizetokens(javaFile,charset);
}
项目:xtext-extras
文件:ContentAssistParserGeneratorFragment.java
@Override
public void generate(Grammar grammar,XpandExecutionContext ctx) {
KeywordHelper helper = new KeywordHelper(grammar,getoptions().isIgnoreCase());
super.generate(grammar,ctx);
final String srcGenPath = ctx.getoutput().getoutlet(Generator.SRC_GEN_IDE).getPath();
final String encoding = getEncoding(ctx,Generator.SRC_GEN_IDE);
String libPath = srcGenPath + "/" + getFragmentHelper().getContentAssistLexerGrammarFileName(grammar).replace('.','/');
libPath = libPath.substring(0,libPath.lastIndexOf('/'));
String absoluteLexerFileName = srcGenPath+"/"+getFragmentHelper().getContentAssistLexerGrammarFileName(grammar).replace('.','/')+".g";
String absoluteParserFileName = srcGenPath+"/"+getFragmentHelper().getContentAssistParserGrammarFileName(grammar).replace('.','/')+".g";
addAntlrParam("-fo");
addAntlrParam(absoluteParserFileName.substring(0,absoluteParserFileName.lastIndexOf('/')));
String[] lexerAntlrParams = getAntlrParams();
lexerAntlrParams[lexerAntlrParams.length - 1] = absoluteLexerFileName.substring(0,absoluteLexerFileName.lastIndexOf('/'));
getAntlrTool().runWithEncodingAndParams(absoluteLexerFileName,lexerAntlrParams);
addAntlrParam("-lib");
addAntlrParam(libPath);
getAntlrTool().runWithEncodingAndParams(absoluteParserFileName,absoluteParserFileName,charset);
splitParserAndLexerIfEnabled(absoluteLexerFileName,charset);
suppressWarnings(absoluteLexerFileName,charset);
normalizeLineDelimiters(absoluteLexerFileName,charset);
normalizetokens(absoluteLexerFileName,charset);
normalizetokens(absoluteParserFileName,charset);
helper.discardHelper(grammar);
}
项目:xtext-extras
文件:DebugAntlrGeneratorFragment.java
@Override
public void generate(Grammar grammar,XpandExecutionContext ctx) {
DebugGrammarToken token = DebugGrammarToken.aquire();
try {
super.generate(grammar,ctx);
String srcGenPath = ctx.getoutput().getoutlet(Generator.SRC_GEN).getPath();
String absoluteGrammarFileName = srcGenPath+"/"+getGrammarFileName(grammar,'/')+".g";
prettyPrint(absoluteGrammarFileName,Charset.forName(getEncoding(ctx,Generator.SRC_GEN)));
} finally {
token.done();
}
}
@Override
public void generate(Grammar grammar,XpandExecutionContext ctx) {
RuleNames.ensureAdapterInstalled(grammar);
super.generate(grammar,ctx);
final ResourceSaveIndicator isSaving = new ResourceSaveIndicator();
// create a defensive clone
Grammar copy = deepcopy(grammar,isSaving);
ResourceSet set = copy.eResource().getResourceSet();
// save grammar model
String path;
if (xmlVersion == null) {
path = GrammarUtil.getClasspathRelativePathToBinGrammar(copy);
} else {
log.warn("'xmlVersion' has been specified for this "
+ GrammaraccessFragment.class.getSimpleName()
+ ". Therefore,the grammar is persisted as XMI and not as binary. This can be a performance drawback.");
path = GrammarUtil.getClasspathRelativePathToXmi(copy);
}
URI uri = URI.createURI(ctx.getoutput().getoutlet(Generator.SRC_GEN).getPath() + "/" + path);
Resource resource = set.createResource(uri,ContentHandler.UNSPECIFIED_CONTENT_TYPE);
addAllGrammarsToResource(resource,copy,new HashSet<Grammar>());
isSaving.set(Boolean.TRUE);
Map<String,Object> saveOptions = Maps.newHashMap();
if (resource instanceof XMLResource) {
((XMLResource) resource).setXMLVersion(getXmlVersion());
} else if (resource instanceof BinaryResourceImpl){
saveOptions.put(BinaryResourceImpl.OPTION_VERSION,BinaryResourceImpl.BinaryIO.Version.VERSION_1_1);
saveOptions.put(BinaryResourceImpl.OPTION_STYLE_DATA_CONVERTER,Boolean.TRUE);
}
try {
resource.save(saveOptions);
} catch (IOException e) {
log.error(e.getMessage(),e);
} finally {
isSaving.set(Boolean.FALSE);
}
}
项目:xtext-extras
文件:SimpleProjectWizardFragment.java
@Override
public void generate(final Grammar grammar,XpandExecutionContext ctx) {
final String templateName = getNewProjectTemplateName(grammar,getNaming());
final Outlet outlet = ctx.getoutput().getoutlet(Generator.SRC_UI);
final File templateFile = new File(new File(outlet.getPath()),templateName.replaceAll("::","/") + '.' + XpandUtil.TEMPLATE_EXTENSION);
final boolean templateExisted = templateFile.exists();
List<Object> parameters = getParameters(grammar);
parameters.add(outlet.getFileEncoding());
XpandFacade.create(ctx).evaluate2(getTemplate()+"::generate",grammar,parameters);
if (!templateExisted && templateFile.exists()) {
LOG.info("A new template " + templateName + " has been generated into " + outlet.getPath() + ".");
LOG.info(" Make sure to enable the Xtend/Xpand nature and JavaBeans metamodel to edit this template.");
}
}
项目:xtext-extras
文件:XtextAntlrGeneratorComparisonFragment.java
/**
* Tweaks the generation of the {@link Generator#SRC_GEN Generator.SRC_GEN},* {@link Generator#SRC_GEN_IDE Generator.SRC_GEN_IDE},and
* {@link Generator#SRC_GEN_UI Generator.SRC_GEN_UI} outlets
* and injects the {@link #getTmpPath()}.
*/
@Override
protected Outlet createOutlet(final boolean append,final String encoding,final String name,final boolean overwrite,final String path) {
Outlet _xifexpression = null;
if (((Objects.equal(name,Generator.SRC_GEN) || Objects.equal(name,Generator.SRC_GEN_IDE)) || Objects.equal(name,Generator.SRC_GEN_UI))) {
_xifexpression = super.createOutlet(append,name,overwrite,this.getTmpFolder().getAbsolutePath());
} else {
_xifexpression = super.createOutlet(append,path);
}
return _xifexpression;
}
项目:antlr4ide
文件:AntlrUiGeneratorFragmentWithCustomLexer.java
@Override
public void generate(final Grammar grammar,final XpandExecutionContext ctx) {
KeywordHelper helper = new KeywordHelper(grammar,getoptions().isIgnoreCase());
super.generate(grammar,ctx);
final String srcGenPath = ctx.getoutput().getoutlet(Generator.SRC_GEN_UI).getPath();
final String encoding = getEncoding(ctx,Generator.SRC_GEN_UI);
String libPath = srcGenPath + "/"
+ getFragmentHelper().getContentAssistLexerGrammarFileName(grammar).replace('.','/');
libPath = libPath.substring(0,libPath.lastIndexOf('/'));
String absoluteLexerFileName = srcGenPath + "/"
+ getFragmentHelper().getContentAssistLexerGrammarFileName(grammar).replace('.','/')
+ ".g";
String absoluteParserFileName = srcGenPath + "/"
+ getFragmentHelper().getContentAssistParserGrammarFileName(grammar).replace('.','/')
+ ".g";
addAntlrParam("-fo");
addAntlrParam(absoluteParserFileName.substring(0,absoluteParserFileName.lastIndexOf('/')));
String[] lexerAntlrParams = getAntlrParams();
lexerAntlrParams[lexerAntlrParams.length - 1] = absoluteLexerFileName.substring(0,absoluteLexerFileName.lastIndexOf('/'));
// copy
copy(new File(absoluteLexerFileName),new File(absoluteLexerFileName.replace(".g",".gxtext")));
writeFile(
absoluteLexerFileName,readFile("../antlr4ide.core/src/main/java/com/github/jknack/parser/antlr/lexer/InternalAntlr4Lexer.g"));
getAntlrTool().runWithEncodingAndParams(absoluteLexerFileName,lexerAntlrParams);
addAntlrParam("-lib");
addAntlrParam(libPath);
getAntlrTool().runWithEncodingAndParams(absoluteParserFileName,getAntlrParams());
Charset charset = Charset.forName(encoding);
simplifyUnorderedGroupPredicatesIfrequired(grammar,charset);
splitParserAndLexerIfEnabled(absoluteLexerFileName,charset);
suppressWarnings(absoluteLexerFileName,charset);
normalizeLineDelimiters(absoluteLexerFileName,charset);
normalizetokens(absoluteLexerFileName,charset);
normalizetokens(absoluteParserFileName,charset);
helper.discardHelper(grammar);
}
项目:xtext-extras
文件:AntlrGeneratorFragment.java
@Override
public void generate(final Grammar grammar,ctx);
final String srcGenPath = ctx.getoutput().getoutlet(Generator.SRC_GEN).getPath();
final String encoding = getEncoding(ctx,Generator.SRC_GEN);
final String lexerBaseFileName = srcGenPath+"/"+getFragmentHelper().getLexerGrammarFileName(grammar).replace('.','/');
String libPath = lexerBaseFileName;
libPath = libPath.substring(0,libPath.lastIndexOf('/'));
String absoluteLexerFileName = lexerBaseFileName + ".g";
String absoluteParserFileName = srcGenPath+"/"+getFragmentHelper().getParserGrammarFileName(grammar).replace('.',lexerAntlrParams);
cleanupLexerTokensFile(lexerBaseFileName,helper,encoding);
addAntlrParam("-lib");
addAntlrParam(libPath);
getAntlrTool().runWithEncodingAndParams(absoluteParserFileName,charset);
MutabletokenDefProvider provider = createLexerTokensprovider(lexerBaseFileName,charset);
for(Map.Entry<Integer,String> entry: provider.getTokenDefMap().entrySet()) {
String value = entry.getValue();
if(helper.isKeywordRule(value)) {
String keywordAsAntlrstring = AntlrGrammarGenUtil.toAntlrstring(helper.getKeywordValue(value));
entry.setValue("'" + keywordAsAntlrstring + "'");
} else if (value.startsWith("'")) {
value = AntlrGrammarGenUtil.toAntlrstring(value);
entry.setValue("'" + value + "'");
}
}
try {
provider.writetokenFile(new PrintWriter(new File(srcGenPath+"/"+getFragmentHelper().getParserGrammarFileName(grammar).replace('.','/') + ".tokens"),encoding));
}
catch (IOException e) {
throw new RuntimeException(e);
}
normalizetokens(absoluteLexerFileName,charset);
helper.discardHelper(grammar);
}
项目:xtext-extras
文件:XtextAntlrGeneratorComparisonFragment.java
@Override
public void generate() {
Naming _naming = this.getNaming();
boolean _tripleEquals = (_naming == null);
if (_tripleEquals) {
this.setNaming(this.createNaming());
}
if ((this.options == null)) {
AntlrOptions _antlrOptions = new AntlrOptions();
this.options = _antlrOptions;
}
final AntlrGrammarcomparator.IErrorHandler errorHandler = this.createErrorHandler();
RuntimeException exception = null;
IRuntimeProjectConfig _runtime = this.getProjectConfig().getRuntime();
IXtextGeneratorFileSystemAccess _srcGen = null;
if (_runtime!=null) {
_srcGen=_runtime.getSrcGen();
}
boolean _tripleNotEquals = (_srcGen != null);
if (_tripleNotEquals) {
exception = this.loadAndCompareGrammars(this.getProjectConfig().getRuntime().getSrcGen(),Generator.SRC_GEN,errorHandler);
}
boolean _and = false;
if (!(((!this.failOnError) || (exception == null)) && (!this.skipContentAssistGrammarcomparison))) {
_and = false;
} else {
IBundleProjectConfig _genericIde = this.getProjectConfig().getGenericIde();
IXtextGeneratorFileSystemAccess _srcGen_1 = null;
if (_genericIde!=null) {
_srcGen_1=_genericIde.getSrcGen();
}
boolean _tripleNotEquals_1 = (_srcGen_1 != null);
_and = _tripleNotEquals_1;
}
if (_and) {
exception = this.loadAndCompareGrammars(this.getProjectConfig().getGenericIde().getSrcGen(),Generator.SRC_GEN_IDE,errorHandler);
}
XtextAntlrGeneratorComparisonFragment.deleteDir(this.getTmpFolder());
if ((this.failOnError && (exception != null))) {
throw exception;
}
}
项目:xtext-extras
文件:Generator2AdapterSetup.java
private XtextProjectConfig createProjectConfig() {
StandardProjectConfig _standardProjectConfig = new StandardProjectConfig();
final Procedure1<StandardProjectConfig> _function = (StandardProjectConfig it) -> {
it.setCreateEclipseMetaData(true);
it.setBaseName(this.naming.getProjectNameRt());
final String runtimeRoot = this.xpandContext.getoutput().getoutlet(Generator.PLUGIN_RT).getPath();
final int projectNameIndex = runtimeRoot.lastIndexOf(it.getBaseName());
if ((projectNameIndex >= 0)) {
it.setRootPath(runtimeRoot.substring(0,projectNameIndex));
} else {
it.setRootPath(runtimeRoot);
}
RuntimeProjectConfig _runtime = it.getRuntime();
_runtime.setName(it.getBaseName());
RuntimeProjectConfig _runtime_1 = it.getRuntime();
_runtime_1.setRoot(runtimeRoot);
RuntimeProjectConfig _runtime_2 = it.getRuntime();
_runtime_2.setSrc(this.xpandContext.getoutput().getoutlet(Generator.SRC).getPath());
RuntimeProjectConfig _runtime_3 = it.getRuntime();
_runtime_3.setSrcGen(this.xpandContext.getoutput().getoutlet(Generator.SRC_GEN).getPath());
RuntimeProjectConfig _runtime_4 = it.getRuntime();
_runtime_4.setEcoreModel(this.xpandContext.getoutput().getoutlet(Generator.MODEL).getPath());
BundleProjectConfig _eclipsePlugin = it.getEclipsePlugin();
_eclipsePlugin.setEnabled(true);
BundleProjectConfig _eclipsePlugin_1 = it.getEclipsePlugin();
_eclipsePlugin_1.setName(this.naming.getProjectNameUi());
BundleProjectConfig _eclipsePlugin_2 = it.getEclipsePlugin();
_eclipsePlugin_2.setRoot(this.xpandContext.getoutput().getoutlet(Generator.PLUGIN_UI).getPath());
BundleProjectConfig _eclipsePlugin_3 = it.getEclipsePlugin();
_eclipsePlugin_3.setSrc(this.xpandContext.getoutput().getoutlet(Generator.SRC_UI).getPath());
BundleProjectConfig _eclipsePlugin_4 = it.getEclipsePlugin();
_eclipsePlugin_4.setSrcGen(this.xpandContext.getoutput().getoutlet(Generator.SRC_GEN_UI).getPath());
BundleProjectConfig _genericIde = it.getGenericIde();
_genericIde.setEnabled(true);
BundleProjectConfig _genericIde_1 = it.getGenericIde();
_genericIde_1.setName(this.naming.getProjectNameIde());
BundleProjectConfig _genericIde_2 = it.getGenericIde();
_genericIde_2.setRoot(this.xpandContext.getoutput().getoutlet(Generator.PLUGIN_IDE).getPath());
BundleProjectConfig _genericIde_3 = it.getGenericIde();
_genericIde_3.setSrc(this.xpandContext.getoutput().getoutlet(Generator.SRC_IDE).getPath());
BundleProjectConfig _genericIde_4 = it.getGenericIde();
_genericIde_4.setSrcGen(this.xpandContext.getoutput().getoutlet(Generator.SRC_GEN_IDE).getPath());
};
return ObjectExtensions.<StandardProjectConfig>operator_doubleArrow(_standardProjectConfig,_function);
}
项目:xtext-extras
文件:Formatter2Fragment.java
@Override
public void generate(final Xtend2ExecutionContext ctx) {
ctx.writeFile(Generator.SRC,this.stubGenerator.getStubFileName(),this.stubGenerator.generateStubFileContents());
}
项目:xtext-extras
文件:ContentAssistFragment.java
@Override
public void generate(final Xtend2ExecutionContext ctx) {
if (this.generateStub) {
String _asPath = this._naming.asPath(this.getProposalProviderName(this.grammar));
String _plus = (_asPath + ".xtend");
StringConcatenation _builder = new StringConcatenation();
String _fileHeader = this._naming.fileHeader();
_builder.append(_fileHeader);
_builder.newLineIfNotEmpty();
_builder.append("package ");
String _packageName = this._naming.packageName(this.getProposalProviderName(this.grammar));
_builder.append(_packageName);
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("import ");
String _genProposalProviderName = this.getGenProposalProviderName();
_builder.append(_genProposalProviderName);
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#content-assist");
_builder.newLine();
_builder.append(" ");
_builder.append("* on how to customize the content assistant.");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("class ");
String _simpleName = this._naming.toSimpleName(this.getProposalProviderName(this.grammar));
_builder.append(_simpleName);
_builder.append(" extends ");
String _simpleName_1 = this._naming.toSimpleName(this.getGenProposalProviderName());
_builder.append(_simpleName_1);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
ctx.writeFile(Generator.SRC_UI,_plus,_builder);
}
XpandFacade.create(ctx.getXpandExecutionContext()).evaluate2(
"org::eclipse::xtext::ui::generator::contentAssist::JavaBasedContentAssistFragment::GenProposalProvider",this.grammar,Collections.<Object>singletonList(this.getSuperClassName()));
}
项目:antlr4ide
文件:AntlrGeneratorFragmentWithCustomLexer.java
@Override
public void generate(final Grammar grammar,ctx);
final String srcGenPath = ctx.getoutput().getoutlet(Generator.SRC_GEN).getPath();
final String encoding = getEncoding(ctx,Generator.SRC_GEN);
final String lexerBaseFileName = srcGenPath+"/"+getFragmentHelper().getLexerGrammarFileName(grammar).replace('.','/');
String libPath = lexerBaseFileName;
libPath = libPath.substring(0,libPath.lastIndexOf('/'));
String absoluteLexerFileName = lexerBaseFileName + ".g";
String absoluteParserFileName = srcGenPath+"/"+getFragmentHelper().getParserGrammarFileName(grammar).replace('.','/')+".g";
addAntlrParam("-fo");
addAntlrParam(absoluteParserFileName.substring(0,new File(lexerBaseFileName + ".gxtext"));
writeFile(absoluteLexerFileName,readFile(absoluteLexerFileName.replace("src-gen","java")));
getAntlrTool().runWithEncodingAndParams(absoluteLexerFileName.replace("//","/"),lexerAntlrParams);
cleanupLexerTokensFile(lexerBaseFileName,encoding);
addAntlrParam("-lib");
addAntlrParam(libPath);
getAntlrTool().runWithEncodingAndParams(absoluteParserFileName,charset);
MutabletokenDefProvider provider = createLexerTokensprovider(lexerBaseFileName,charset);
for(Map.Entry<Integer,String> entry: provider.getTokenDefMap().entrySet()) {
String value = entry.getValue();
if(helper.isKeywordRule(value)) {
String keywordAsAntlrstring = AntlrGrammarGenUtil.toAntlrstring(helper.getKeywordValue(value));
entry.setValue("'" + keywordAsAntlrstring + "'");
} else if (value.startsWith("'")) {
value = AntlrGrammarGenUtil.toAntlrstring(value);
entry.setValue("'" + value + "'");
}
}
try {
provider.writetokenFile(new PrintWriter(new File(srcGenPath+"/"+getFragmentHelper().getParserGrammarFileName(grammar).replace('.',encoding));
}
catch (IOException e) {
throw new RuntimeException(e);
}
normalizetokens(absoluteLexerFileName,charset);
helper.discardHelper(grammar);
}
项目:dsl-devkit
文件:FormatFragmentUtil.java
/**
* Returns a URI corresponding to the default location for format files. This is in the SRC outlet where the Xtext grammar file usually is.
*
* @param grammar
* Xtext grammar to get format file URI for
* @param ctx
* xpand execution context (defines required SRC outlet)
* @return the file URI to the default format file location
*/
private static URI getDefaultFormatLocation(final Grammar grammar,final XpandExecutionContext ctx) {
final String xmiPath = GrammarUtil.getClasspathRelativePathToXmi(grammar);
return URI.createFileURI(new File(ctx.getoutput().getoutlet(Generator.SRC).getPath(),xmiPath).getAbsolutePath()).trimFileExtension().appendFileExtension(FormatConstants.FILE_EXTENSION);
}