Browse Source

Moves Terminal Converter to Expressions Language (#1377)

* Moves Terminal Converter to Expressions Language

The Expressions Language defines the Hex Terminal Literal, thus the
corresponding terminal converter shouldbe part of the expressions
language aswell

* Update STextJavaValidatorTest.java
Andreas Mülder 8 years ago
parent
commit
095f6e7847

+ 1 - 0
plugins/org.yakindu.base.expressions/META-INF/MANIFEST.MF

@@ -36,5 +36,6 @@ Export-Package: org.yakindu.base.expressions,
  org.yakindu.base.expressions.scoping,
  org.yakindu.base.expressions.serializer,
  org.yakindu.base.expressions.services,
+ org.yakindu.base.expressions.terminals,
  org.yakindu.base.expressions.validation
 Bundle-ClassPath: .

+ 1 - 1
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/conversion/BoolValueConverter.java

@@ -8,7 +8,7 @@
  * committers of YAKINDU - initial API and implementation
  *
 */
-package org.yakindu.sct.model.stext.conversion;
+package org.yakindu.base.expressions.terminals;
 
 import org.eclipse.xtext.conversion.ValueConverterException;
 import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter;

+ 2 - 2
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/conversion/StextValueConverterService.java

@@ -8,7 +8,7 @@
  * committers of YAKINDU - initial API and implementation
  *
 */
-package org.yakindu.sct.model.stext.conversion;
+package org.yakindu.base.expressions.terminals;
 
 import org.eclipse.xtext.common.services.DefaultTerminalConverters;
 import org.eclipse.xtext.conversion.IValueConverter;
@@ -19,7 +19,7 @@ import org.eclipse.xtext.conversion.ValueConverter;
  * 
  * @author axel terfloth
  */
-public class StextValueConverterService extends DefaultTerminalConverters {
+public class ExpressionsValueConverterService extends DefaultTerminalConverters {
 	
 	protected BoolValueConverter boolConverter = new BoolValueConverter();
 	protected HexValueConverter hexConverter = new HexValueConverter();

+ 2 - 2
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/conversion/HexValueConverter.java

@@ -8,7 +8,7 @@
  * committers of YAKINDU - initial API and implementation
  *
 */
-package org.yakindu.sct.model.stext.conversion;
+package org.yakindu.base.expressions.terminals;
 
 import org.eclipse.xtext.conversion.ValueConverterException;
 import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter;
@@ -30,7 +30,7 @@ public class HexValueConverter extends AbstractLexerBasedConverter<Integer> {
 			throw new ValueConverterException("Couldn't convert empty string to number.", node, null);
 
 		try {
-			// per form the conversion with string index 2 since the prefix is always '0x'
+			// perform the conversion with string index 2 since the prefix is always '0x'
 			return Integer.parseInt(string.substring(2), 16);
 		} catch ( NumberFormatException e ) {
 			throw new ValueConverterException("Couldn't convert '" + string + "' to number.", node, null);

+ 1 - 2
plugins/org.yakindu.sct.model.stext/META-INF/MANIFEST.MF

@@ -25,7 +25,7 @@ Import-Package: org.apache.commons.logging,
  org.eclipse.xtext.xbase.lib
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Export-Package: org.yakindu.sct.model.stext,
- org.yakindu.sct.model.stext.conversion,
+ org.yakindu.sct.model.stext.expressions,
  org.yakindu.sct.model.stext.formatting,
  org.yakindu.sct.model.stext.inferrer,
  org.yakindu.sct.model.stext.naming,
@@ -39,7 +39,6 @@ Export-Package: org.yakindu.sct.model.stext,
  org.yakindu.sct.model.stext.stext,
  org.yakindu.sct.model.stext.stext.impl,
  org.yakindu.sct.model.stext.stext.util,
- org.yakindu.sct.model.stext.expressions,
  org.yakindu.sct.model.stext.util,
  org.yakindu.sct.model.stext.validation
 Bundle-ClassPath: .

+ 8 - 9
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/STextRuntimeModule.java

@@ -17,11 +17,11 @@ import org.eclipse.xtext.naming.IQualifiedNameProvider;
 import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader;
 import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
 import org.eclipse.xtext.validation.CompositeEValidator;
+import org.yakindu.base.expressions.terminals.ExpressionsValueConverterService;
 import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
 import org.yakindu.base.types.typesystem.GenericTypeSystem;
 import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.sgraph.resource.SCTLinker;
-import org.yakindu.sct.model.stext.conversion.StextValueConverterService;
 import org.yakindu.sct.model.stext.inferrer.STextTypeInferrer;
 import org.yakindu.sct.model.stext.naming.StextNameProvider;
 import org.yakindu.sct.model.stext.resource.SCTResourceDescriptionStrategy;
@@ -40,14 +40,14 @@ import com.google.inject.name.Names;
  */
 public class STextRuntimeModule extends org.yakindu.sct.model.stext.AbstractSTextRuntimeModule {
 
-	
 	@Override
 	public void configure(Binder binder) {
 		super.configure(binder);
 		binder.bind(IDefaultResourceDescriptionStrategy.class).to(SCTResourceDescriptionStrategy.class);
-		//https://github.com/Yakindu/statecharts/issues/1199
+		// https://github.com/Yakindu/statecharts/issues/1199
 		binder.bind(IReferableElementsUnloader.class).to(IReferableElementsUnloader.NullUnloader.class);
 	}
+
 	public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() {
 		return STextGlobalScopeProvider.class;
 	}
@@ -68,10 +68,9 @@ public class STextRuntimeModule extends org.yakindu.sct.model.stext.AbstractSTex
 
 	@Override
 	public Class<? extends org.eclipse.xtext.conversion.IValueConverterService> bindIValueConverterService() {
-		return StextValueConverterService.class;
+		return ExpressionsValueConverterService.class;
 	}
 
-
 	public void configureFileExtensions(Binder binder) {
 		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("stext,sct");
 	}
@@ -83,14 +82,14 @@ public class STextRuntimeModule extends org.yakindu.sct.model.stext.AbstractSTex
 						.named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
 				.to(org.yakindu.sct.model.stext.scoping.StextImportAwareScopeProvider.class);
 		binder.bind(ITypeSystem.class).toInstance(getTypeSystem());
-		binder.bind(boolean.class).annotatedWith(
-				Names.named(CompositeEValidator.USE_EOBJECT_VALIDATOR)).toInstance(false);
+		binder.bind(boolean.class).annotatedWith(Names.named(CompositeEValidator.USE_EOBJECT_VALIDATOR))
+				.toInstance(false);
 	}
-	
+
 	protected ITypeSystem getTypeSystem() {
 		return GenericTypeSystem.getInstance();
 	}
-	
+
 	public Class<? extends ITypeSystemInferrer> bindITypeSystemInferrer() {
 		return STextTypeInferrer.class;
 	}