Skip to content

Commit

Permalink
[mwe2] Use the MWE2 API version 2.
Browse files Browse the repository at this point in the history
see #352

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Jan 23, 2016
1 parent 7dcdb81 commit 682808f
Show file tree
Hide file tree
Showing 113 changed files with 19,464 additions and 90 deletions.
Expand Up @@ -4,7 +4,7 @@
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2015 the original authors or authors.
* Copyright (C) 2014-2016 the original authors or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion external_tools/gtk/sarl.lang
Expand Up @@ -9,7 +9,7 @@
SARL is an general-purpose agent programming language.
More details on http://www.sarl.io
Copyright 2016 the original authors and authors.
Copyright 2014-2016 the original authors and authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions external_tools/latex/sarl-beamer-listing.sty
Expand Up @@ -7,7 +7,7 @@
% SARL is an general-purpose agent programming language.
% More details on http://www.sarl.io
%
% Copyright 2016 the original authors and authors.
% Copyright 2014-2016 the original authors and authors.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-beamer-listing}[2016/01/07]
\ProvidesPackage{sarl-beamer-listing}[2016/01/23]
\RequirePackage{algpseudocode}
\RequirePackage{listings}
\RequirePackage{xspace}
Expand Down
4 changes: 2 additions & 2 deletions external_tools/latex/sarl-colorized-listing.sty
Expand Up @@ -7,7 +7,7 @@
% SARL is an general-purpose agent programming language.
% More details on http://www.sarl.io
%
% Copyright 2016 the original authors and authors.
% Copyright 2014-2016 the original authors and authors.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-colorized-listing}[2016/01/07]
\ProvidesPackage{sarl-colorized-listing}[2016/01/23]
\RequirePackage{algpseudocode}
\RequirePackage{listings}
\RequirePackage{xspace}
Expand Down
4 changes: 2 additions & 2 deletions external_tools/latex/sarl-listing.sty
Expand Up @@ -7,7 +7,7 @@
% SARL is an general-purpose agent programming language.
% More details on http://www.sarl.io
%
% Copyright 2016 the original authors and authors.
% Copyright 2014-2016 the original authors and authors.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-listing}[2016/01/07]
\ProvidesPackage{sarl-listing}[2016/01/23]
\RequirePackage{algpseudocode}
\RequirePackage{listings}
\RequirePackage{xspace}
Expand Down
2 changes: 1 addition & 1 deletion external_tools/prettify/lang-sarl.js
Expand Up @@ -7,7 +7,7 @@
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright 2016 the original authors and authors.
* Copyright 2014-2016 the original authors and authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Expand Up @@ -7,7 +7,7 @@
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright 2016 the original authors and authors.
* Copyright 2014-2016 the original authors and authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
89 changes: 65 additions & 24 deletions plugins/io.sarl.lang.mwe2/GenerateSARL2.mwe2
Expand Up @@ -34,7 +34,7 @@ import io.sarl.lang.mwe2.externalLang.*
import io.sarl.lang.mwe2.prettify.*
import io.sarl.lang.mwe2.latex.*
import io.sarl.lang.mwe2.gtk.*
import io.sarl.lang.mwe2.junit.*
import io.sarl.lang.mwe2.codebuilder.*

var rootRootPath = "../.."
var rootPath = ".."
Expand Down Expand Up @@ -68,7 +68,7 @@ var fileHeader = "/*
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright \${year} the original authors and authors.
* Copyright 2014-\${year} the original authors and authors.
*
* Licensed under the Apache License, Version 2.0 (the \"License\");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -142,6 +142,49 @@ Workflow {
fileHeader = fileHeader
preferXtendStubs = false
}
codeBuilder = auto-inject {
scriptRuleName = "SarlScript"
topElementRuleName = "Type"
formalParameterRuleName = "Parameter"
formalParameterContainerType = "org.eclipse.xtend.core.xtend.XtendExecutable"
constructorFreeRuleName = "Capacity"
constructorFreeRuleName = "Interface"
constructorFreeRuleName = "Enum"
constructorFreeRuleName = "AnnotationType"
defaultSuper = {
type = "SarlAgent"
super = "io.sarl.lang.core.Agent"
}
defaultSuper = {
type = "SarlBehavior"
super = "io.sarl.lang.core.Behavior"
}
defaultSuper = {
type = "SarlCapacity"
super = "io.sarl.lang.core.Capacity"
}
defaultSuper = {
type = "SarlEvent"
super = "io.sarl.lang.core.Event"
}
defaultSuper = {
type = "SarlSkill"
super = "io.sarl.lang.core.Skill"
}
noActionBodyType = "SarlCapacity"
noActionBodyType = "SarlEvent"
noActionBodyType = "SarlAnnotationType"
noActionBodyType = "SarlInterface"
modifier = {
type = "SarlAction"
modifier = "def"
}
modifier = {
type = "SarlField"
modifier = "var"
modifier = "val"
}
}
highlighting = auto-inject {
// Shared configuration between the generators
addNativeTypes = true
Expand Down Expand Up @@ -298,6 +341,11 @@ Workflow {
fragment = junit.Junit4Fragment2 auto-inject {
generateStub = false
}

// Generate an helpful creator of Ecore elements.
fragment = CodeBuilderFragment2 auto-inject {
generateStub = false
}

// generate the Google Prettify style
fragment = GooglePrettifyGenerator2 auto-inject {
Expand Down Expand Up @@ -333,7 +381,7 @@ Workflow {
overrideAll = true

runtime = {
bind = "io.sarl.lang.actionprototype.ActionPrototypeProvider"
bind = "io.sarl.lang.actionprototype.IActionPrototypeProvider"
to = "io.sarl.lang.actionprototype.DefaultActionPrototypeProvider"
}
runtime = {
Expand All @@ -349,8 +397,8 @@ Workflow {
to = "io.sarl.lang.controlflow.SARLExtendedEarlyExitComputer"
}
runtime = {
bind = "io.sarl.lang.typing.ExtendedXExpressionHelper"
to = "io.sarl.lang.typing.ExtendedXExpressionHelper"
bind = "io.sarl.lang.typing.SARLExpressionHelper"
to = "io.sarl.lang.typing.SARLExpressionHelper"
}
runtime = {
bind = "io.sarl.lang.validation.FeatureCallValidator"
Expand All @@ -368,10 +416,6 @@ Workflow {
bind = "org.eclipse.xtext.xbase.controlflow.IEarlyExitComputer"
to = "io.sarl.lang.controlflow.SARLEarlyExitComputer"
}
runtime = {
bind = "org.eclipse.xtext.serializer.sequencer.IHiddenTokenSequencer"
to = "io.sarl.lang.ecoregenerator.helper.SARLHiddenTokenSequencer"
}
runtime = {
bind = "org.eclipse.xtext.xbase.jvmmodel.IJvmModelInferrer"
to = "io.sarl.lang.jvmmodel.SARLJvmModelInferrer"
Expand All @@ -382,29 +426,30 @@ Workflow {
}
runtime = {
bind = "org.eclipse.xtext.generator.IOutputConfigurationProvider"
to = "io.sarl.lang.compiler.SarlOutputConfigurationProvider"
}
runtime = {
bind = "org.eclipse.xtext.serializer.acceptor.ISyntacticSequenceAcceptor"
to = "io.sarl.lang.ecoregenerator.helper.SARLHiddenTokenSequencer"
to = "io.sarl.lang.generator.SarlOutputConfigurationProvider"
}
runtime = {
bind = "org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator"
to = "io.sarl.lang.jvmmodel.SarlJvmModelAssociations$Impl"
}
runtime = {
bind = "org.eclipse.xtext.findReferences.ReferenceFinder"
to = "io.sarl.lang.findreferences.SARLReferenceFinder"
}
runtime = {
bind = "io.sarl.lang.sarl.SarlFactory"
to = "SarlFactory.eINSTANCE"
singleton = true
instance = true
}
runtime = {
bind = "org.eclipse.xtext.findReferences.ReferenceFinder"
to = "io.sarl.lang.findreferences.SARLReferenceFinder"
}
runtime = {
bind = "org.eclipse.xtext.xbase.util.XExpressionHelper"
to = "io.sarl.lang.typing.SARLXExpressionHelper"
to = "io.sarl.lang.typing.SARLExpressionHelper"
}
runtime = {
bind = "org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer"
to = "io.sarl.lang.serializer.SARLSyntacticSequencerCustom"
override = true
}

ui = {
Expand Down Expand Up @@ -469,7 +514,7 @@ Workflow {

both = {
bind = "org.eclipse.xtext.generator.IContextualOutputConfigurationProvider"
to = "io.sarl.lang.compiler.SarlOutputConfigurationProvider"
to = "io.sarl.lang.generator.SarlOutputConfigurationProvider"
}
}

Expand Down Expand Up @@ -511,10 +556,6 @@ Workflow {
bind = "org.eclipse.xtext.conversion.impl.IDValueConverter"
to = "org.eclipse.xtend.core.conversion.JavaIDValueConverter"
}
runtime = {
bind = "org.eclipse.xtext.documentation.IEObjectDocumentationProvider"
to = "org.eclipse.xtend.core.documentation.XtendDocumentationProvider"
}
runtime = {
bind = "org.eclipse.xtext.documentation.IFileHeaderProvider"
to = "org.eclipse.xtend.core.documentation.XtendFileHeaderProvider"
Expand Down
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xtext.generator.DefaultGeneratorModule;

import io.sarl.lang.mwe2.codebuilder.CodeBuilderConfig;
import io.sarl.lang.mwe2.externalLang.ExternalHighlightingConfig;

/**
Expand All @@ -39,6 +40,8 @@ public class SarlGeneratorModule extends DefaultGeneratorModule {

private ExternalHighlightingConfig highlighting = new ExternalHighlightingConfig();

private CodeBuilderConfig codeBuilderConfig = new CodeBuilderConfig();

/** Configure the injection of the highlighting configuration.
*
* @param binder the injection binder.
Expand Down Expand Up @@ -66,4 +69,31 @@ public ExternalHighlightingConfig getHighlighting() {
return this.highlighting;
}

/** Configure the injection of the Ecore type creator.
*
* @param binder the injection binder.
*/
public void configureCodeBuilder(Binder binder) {
binder.bind(CodeBuilderConfig.class).toInstance(this.codeBuilderConfig);
}

/** Set the configuration for the Ecore type creator.
*
* @param config the configuration.
*/
public void setCodeBuilder(CodeBuilderConfig config) {
if (config != null) {
this.codeBuilderConfig = config;
}
}

/** Replies the configuration for the Ecore type creator.
*
* @return the configuration.
*/
@Pure
public CodeBuilderConfig getCodeBuilder() {
return this.codeBuilderConfig;
}

}

0 comments on commit 682808f

Please sign in to comment.