removed package from grammar

parent fc327e1a
......@@ -3,10 +3,25 @@
*/
package de.cau.se.teetime.configuration.dsl.ui.contentassist
import de.cau.se.teetime.configuration.dsl.config.Stage
import org.eclipse.emf.ecore.EObject
import org.eclipse.xtext.RuleCall
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor
/**
* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#content-assist
* on how to customize the content assistant.
*/
class ConfigProposalProvider extends AbstractConfigProposalProvider {
override complete_Stage(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.complete_Stage(model, ruleCall, context, acceptor)
val stage = (model as Stage)
if (stage.active) {
createCompletionProposal("Bla", "DispStr", null, context)
} else {
}
}
}
......@@ -5,7 +5,6 @@
<eClassifiers xsi:type="ecore:EClass" name="Configuration">
<eStructuralFeatures xsi:type="ecore:EReference" name="imports" upperBound="-1"
eType="#//ImportDeclaration" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="package" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="argumentList" eType="#//ArgumentDeclarationList"
containment="true"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.10.0" modelDirectory="/de.cau.se.teetime.configuration.dsl/src-gen"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.9.2" modelDirectory="/de.cau.se.teetime.configuration.dsl/src-gen"
modelPluginID="de.cau.se.teetime.configuration.dsl" forceOverwrite="true" modelName="Config"
updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.11">
......@@ -8,7 +8,6 @@
fileExtensions="config" ecorePackage="Config.ecore#/">
<genClasses ecoreClass="Config.ecore#//Configuration">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/imports"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Config.ecore#//Configuration/package"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Config.ecore#//Configuration/type"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/argumentList"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/elements"/>
......
......@@ -6,7 +6,7 @@ Configuration:
//most projects will have only few configurations, so we enforce one configuration per file
//a configuration must have a name and optionally a package
(imports+=ImportDeclaration)*
(package=QualifiedName)? type=QualifiedName '('(argumentList=ArgumentDeclarationList)?')''{'
type=QualifiedName '('(argumentList=ArgumentDeclarationList)?')''{'
(elements += ConfigurationElement)*
'}'
;
......
......@@ -30,12 +30,11 @@ class ConfigGenerator extends AbstractGenerator {
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
var split = resource.URI.toString.split("\\/")
System.err.print("FIL3: ")
var foundSrc = false;
var package = newArrayList()
split = split.subList(0,split.size-2)
for(value : split){
if (foundSrc){
split = split.subList(0, split.size - 2)
for (value : split) {
if (foundSrc) {
package.add(value)
} else if (value.matches("src*")) {
foundSrc = true
......@@ -44,9 +43,6 @@ class ConfigGenerator extends AbstractGenerator {
val packageName = String.join(".", package)
package.add("")
val pathName = String.join("/", package)
System.err.println(pathName)
System.err.println(packageName)
// for (c : resource.allContents.toIterable.filter(Configuration)) {
// model = c
// if (c.package != null) {
......@@ -62,9 +58,7 @@ class ConfigGenerator extends AbstractGenerator {
def compileConfig(Configuration c, String packageName) '''
«compileHeader»
«IF c.package != null»
package «packageName.toString»;
«ENDIF»
package «packageName.toString»;
«c.compileImports»
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment