From 30395a1dd34b8c6316dd6b067309c5d7a8c90e31 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 4 Sep 2022 15:55:49 +0200 Subject: [PATCH 01/51] #347 Added dark/light theme support to SeText base text editor. --- .../META-INF/MANIFEST.MF | 6 +- .../texteditorbase/GenericTextEditor.java | 148 ++++++++++++++++-- .../GenericTextEditorFolding.java | 4 +- .../GenericTextEditorPreferencePage.java | 56 +++++++ .../commands/CommentHandler.java | 2 +- .../commands/CommentHandlerBase.java | 14 +- .../commands/UncommentHandler.java | 2 +- .../themes/AutoDarkLightTheme.java | 62 ++++++++ .../themes/DefaultTextEditorThemeNames.java | 26 +++ .../themes/TextEditorTheme.java | 31 ++++ 10 files changed, 328 insertions(+), 23 deletions(-) create mode 100644 setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditorPreferencePage.java create mode 100644 setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java create mode 100644 setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/DefaultTextEditorThemeNames.java create mode 100644 setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/TextEditorTheme.java diff --git a/setext/org.eclipse.escet.setext.texteditorbase/META-INF/MANIFEST.MF b/setext/org.eclipse.escet.setext.texteditorbase/META-INF/MANIFEST.MF index 6c487fb38..3cdaef49e 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/META-INF/MANIFEST.MF +++ b/setext/org.eclipse.escet.setext.texteditorbase/META-INF/MANIFEST.MF @@ -11,7 +11,8 @@ Export-Package: org.eclipse.escet.setext.texteditorbase, org.eclipse.escet.setext.texteditorbase.detectors, org.eclipse.escet.setext.texteditorbase.highlight, org.eclipse.escet.setext.texteditorbase.rules, - org.eclipse.escet.setext.texteditorbase.scanners + org.eclipse.escet.setext.texteditorbase.scanners, + org.eclipse.escet.setext.texteditorbase.themes Require-Bundle: org.eclipse.swt;bundle-version="3.113.0", org.eclipse.jface;bundle-version="3.18.0", org.eclipse.jface.text;bundle-version="3.16.100", @@ -27,5 +28,6 @@ Require-Bundle: org.eclipse.swt;bundle-version="3.113.0", org.eclipse.ui.workbench.texteditor;bundle-version="3.14.0", org.eclipse.core.commands;bundle-version="3.9.600", org.eclipse.ui.workbench;bundle-version="3.117.0", - org.apache.commons.lang3;bundle-version="3.1.0" + org.apache.commons.lang3;bundle-version="3.1.0", + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.13.0" Automatic-Module-Name: org.eclipse.escet.setext.texteditorbase diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java index 00863144d..882b6eeae 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java @@ -16,9 +16,13 @@ package org.eclipse.escet.setext.texteditorbase; import static org.eclipse.escet.common.java.Lists.list; import static org.eclipse.escet.common.java.Maps.map; import static org.eclipse.escet.common.java.Strings.fmt; +import static org.eclipse.escet.setext.texteditorbase.themes.DefaultTextEditorThemeNames.AUTO; +import static org.eclipse.escet.setext.texteditorbase.themes.DefaultTextEditorThemeNames.DARK; +import static org.eclipse.escet.setext.texteditorbase.themes.DefaultTextEditorThemeNames.LIGHT; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; @@ -27,7 +31,12 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; +import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.escet.common.app.framework.AppEnv; import org.eclipse.escet.common.app.framework.options.Options; import org.eclipse.escet.common.app.framework.output.OutputMode; @@ -42,6 +51,8 @@ import org.eclipse.escet.setext.runtime.Parser; import org.eclipse.escet.setext.runtime.SyntaxWarning; import org.eclipse.escet.setext.runtime.exceptions.SyntaxException; import org.eclipse.escet.setext.texteditorbase.scanners.GenericPartitionScanner; +import org.eclipse.escet.setext.texteditorbase.themes.AutoDarkLightTheme; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.FindReplaceDocumentAdapter; @@ -51,8 +62,10 @@ import org.eclipse.jface.text.IDocumentPartitioner; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.rules.FastPartitioner; import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.jface.text.source.ISourceViewerExtension2; import org.eclipse.jface.text.source.IVerticalRuler; import org.eclipse.jface.text.source.projection.ProjectionViewer; +import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorDescriptor; @@ -66,6 +79,7 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.ide.FileStoreEditorInput; import org.eclipse.ui.statushandlers.StatusManager; @@ -79,8 +93,11 @@ import org.eclipse.ui.texteditor.MarkerUtilities; * type, such as {@link Object}. * @param The type of the decorated abstract syntax tree that results from type checking. If no type checker is * available, use a dummy type, such as {@link Object}. + * @param The enum with the named styles of the text editor. */ -public class GenericTextEditor extends TextEditor implements IDocumentListener, IPartListener { +public class GenericTextEditor> extends TextEditor + implements IDocumentListener, IPartListener, IPreferenceChangeListener +{ /** Whether to print debugging information related to validation timing. */ private static final boolean DEBUG_TIMING = false; @@ -111,6 +128,15 @@ public class GenericTextEditor extends TextEditor implements IDocumentLi /** The partition scanner to use for the text editor. */ private final GenericPartitionScanner scanner; + /** The creator that given a theme creates a themed source viewer configuration for the text editor. */ + private final Function, GenericSourceViewerConfiguration> sourceViewerConfigCreator; + + /** The dark theme for the text editor. */ + private final TextEditorTheme darkTheme; + + /** The light theme for the text editor. */ + private final TextEditorTheme lightTheme; + /** The SeText generated parser class to use for parsing, or {@code null} if no parser is available. */ private final Class> parserClass; @@ -139,7 +165,10 @@ public class GenericTextEditor extends TextEditor implements IDocumentLi * Constructor for the {@link GenericTextEditor} class. * * @param scanner The partition scanner to use for the text editor. - * @param viewerConfig The text editor source viewer configuration to use for the text editor. + * @param sourceViewerConfigCreator The creator that given a theme creates a themed source viewer configuration for + * the text editor. + * @param darkTheme The dark theme for the text editor. + * @param lightTheme The light theme for the text editor. * @param parserClass The SeText generated parser class to use for parsing, or {@code null} if no parser is * available. * @param typeCheckerClass The type checker class to use for type checking, or {@code null} if no type checker is @@ -151,21 +180,28 @@ public class GenericTextEditor extends TextEditor implements IDocumentLi * @param singleLineCommentChars The single line comment characters for the language supported by this text editor, * or {@code null} if not applicable. */ - public GenericTextEditor(GenericPartitionScanner scanner, GenericSourceViewerConfiguration viewerConfig, - Class> parserClass, Class> typeCheckerClass, - String syntaxProblemMarkerId, String semanticProblemMarkerId, String singleLineCommentChars) + public GenericTextEditor(GenericPartitionScanner scanner, + Function, GenericSourceViewerConfiguration> sourceViewerConfigCreator, + TextEditorTheme darkTheme, TextEditorTheme lightTheme, Class> parserClass, + Class> typeCheckerClass, String syntaxProblemMarkerId, + String semanticProblemMarkerId, String singleLineCommentChars) { this.scanner = scanner; + this.sourceViewerConfigCreator = sourceViewerConfigCreator; + this.darkTheme = darkTheme; + this.lightTheme = lightTheme; this.parserClass = parserClass; this.typeCheckerClass = typeCheckerClass; this.syntaxProblemMarkerId = syntaxProblemMarkerId; this.semanticProblemMarkerId = semanticProblemMarkerId; this.singleLineCommentChars = singleLineCommentChars; - colorManager = new ColorManager(); - viewerConfig.setColorManager(colorManager); - viewerConfig.setPartitionScanner(scanner); - viewerConfig.setPreferenceStore(getPreferenceStore()); - setSourceViewerConfiguration(viewerConfig); + this.colorManager = new ColorManager(); + + TextEditorTheme configuredTheme = getConfiguredTheme(); + GenericSourceViewerConfiguration sourceViewerConfig = createThemedSourceViewerConfig(configuredTheme); + setSourceViewerConfiguration(sourceViewerConfig); + + registerThemePreferenceChangeListener(); } @Override @@ -340,6 +376,94 @@ public class GenericTextEditor extends TextEditor implements IDocumentLi return viewer; } + /** + * Returns the theme configured for this text editor. + * + * @return The theme. + */ + private TextEditorTheme getConfiguredTheme() { + // Get configured theme name. + String themeName = Platform.getPreferencesService().getString(EditorsUI.PLUGIN_ID, + getClass().getPackageName() + ".theme", AUTO, null); + + // Return the theme. + if (themeName.equals(DARK)) { + return darkTheme; + } else if (themeName.equals(LIGHT)) { + return lightTheme; + } else { // 'auto', or some other value. + return new AutoDarkLightTheme<>(darkTheme, lightTheme); + } + } + + /** + * Applies a new theme to the text editor. + * + * @param theme The theme to apply. + */ + private void retheme(TextEditorTheme theme) { + // Get source viewer. + ISourceViewer viewer = getSourceViewer(); + Assert.check(viewer instanceof ISourceViewerExtension2); + ISourceViewerExtension2 viewer2 = (ISourceViewerExtension2)viewer; + + // Configure a new source viewer configuration. + viewer2.unconfigure(); + viewer.configure(createThemedSourceViewerConfig(theme)); + } + + /** + * Creates a themed source viewer configuration for this text editor. + * + * @param theme The theme to use. + * @return The themed source viewer configuration. + */ + private GenericSourceViewerConfiguration createThemedSourceViewerConfig(TextEditorTheme theme) { + GenericSourceViewerConfiguration sourceViewerConfig = sourceViewerConfigCreator.apply(theme); + sourceViewerConfig.setColorManager(colorManager); + sourceViewerConfig.setPartitionScanner(scanner); + sourceViewerConfig.setPreferenceStore(getPreferenceStore()); + return sourceViewerConfig; + } + + @Override + protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { + // Handle text editor theme preference change. + if (event.getProperty().equals(getClass().getPackageName() + ".theme")) { + TextEditorTheme theme = getConfiguredTheme(); + retheme(theme); + return; + } + + // Let super class handle other preference changes. + super.handlePreferenceStoreChanged(event); + } + + @Override + public void preferenceChange(PreferenceChangeEvent event) { + // Handle Eclipse theme preference change. + if (event.getKey().equals("themeid")) { + TextEditorTheme theme = getConfiguredTheme(); + retheme(theme); + } + } + + /** Registers this text editor as theme-related preference change listener. */ + private void registerThemePreferenceChangeListener() { + @SuppressWarnings("restriction") + IEclipsePreferences preferences = InstanceScope.INSTANCE + .getNode(org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.THEME_PLUGIN_ID); + preferences.addPreferenceChangeListener(this); + } + + /** Unregisters this text editor as theme-related preference change listener. */ + private void unregisterThemePreferenceChangeListener() { + @SuppressWarnings("restriction") + IEclipsePreferences preferences = InstanceScope.INSTANCE + .getNode(org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.THEME_PLUGIN_ID); + preferences.removePreferenceChangeListener(this); + } + @Override public void doSave(IProgressMonitor progressMonitor) { stripTrailingWhitespace(); @@ -805,6 +929,10 @@ public class GenericTextEditor extends TextEditor implements IDocumentLi IPartService ps = getSite().getWorkbenchWindow().getPartService(); ps.removePartListener(this); + // Unregister theme-related preference change listener if this editor + // is closed, to allow garbage collection of this editor. + unregisterThemePreferenceChangeListener(); + // Save folding state. Fails if the file no longer exists, for instance // because it has been renamed. However, failures are ignored, so it's // not a problem. diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditorFolding.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditorFolding.java index 3d22df75b..c760ec4a7 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditorFolding.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditorFolding.java @@ -51,7 +51,7 @@ public class GenericTextEditorFolding { private static final QualifiedName PERSIST_NAME = new QualifiedName(PACKAGE_NAME, "collapsedFoldRanges"); /** The text editor to which folding support is to be provided. */ - private final GenericTextEditor textEditor; + private final GenericTextEditor textEditor; /** Projection annotation model, for folding support. */ private ProjectionAnnotationModel projAnnoModel; @@ -70,7 +70,7 @@ public class GenericTextEditorFolding { * * @param textEditor The text editor to which folding support is to be provided. */ - public GenericTextEditorFolding(GenericTextEditor textEditor) { + public GenericTextEditorFolding(GenericTextEditor textEditor) { this.textEditor = textEditor; } diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditorPreferencePage.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditorPreferencePage.java new file mode 100644 index 000000000..a50d3e65e --- /dev/null +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditorPreferencePage.java @@ -0,0 +1,56 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.setext.texteditorbase; + +import static org.eclipse.escet.setext.texteditorbase.themes.DefaultTextEditorThemeNames.AUTO; +import static org.eclipse.escet.setext.texteditorbase.themes.DefaultTextEditorThemeNames.DARK; +import static org.eclipse.escet.setext.texteditorbase.themes.DefaultTextEditorThemeNames.LIGHT; + +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.ComboFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.editors.text.EditorsUI; +import org.eclipse.ui.preferences.ScopedPreferenceStore; + +/** + * Generic text editor preference page. + * + *

+ * This class is to be extended for concrete text editors. However, no methods need to be overridden. Simply extending + * this class is sufficient. The derived preference page class must however be part of the the same package as the text + * editor class for that text editor, for the preferences to be picked up by that text editor. + *

+ */ +public abstract class GenericTextEditorPreferencePage extends FieldEditorPreferencePage + implements IWorkbenchPreferencePage +{ + /** Constructor for the {@link GenericTextEditorPreferencePage} class. */ + public GenericTextEditorPreferencePage() { + super(GRID); + } + + @Override + public void init(IWorkbench workbench) { + setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, EditorsUI.PLUGIN_ID)); + } + + @Override + protected void createFieldEditors() { + String[][] namesAndValues = {{"Automatic", AUTO}, {"Dark", DARK}, {"Light", LIGHT}}; + addField(new ComboFieldEditor(getClass().getPackageName() + ".theme", "&Theme:", namesAndValues, + getFieldEditorParent())); + } +} diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/CommentHandler.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/CommentHandler.java index 5ee62814a..98297985d 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/CommentHandler.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/CommentHandler.java @@ -36,7 +36,7 @@ public class CommentHandler extends CommentHandlerBase { @Override public Object execute(ExecutionEvent event) throws ExecutionException { // Get generic text editor. - GenericTextEditor editor = getTextEditor(event); + GenericTextEditor editor = getTextEditor(event); if (editor == null) { return null; } diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/CommentHandlerBase.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/CommentHandlerBase.java index d014a5c11..8b5915106 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/CommentHandlerBase.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/CommentHandlerBase.java @@ -56,18 +56,18 @@ public abstract class CommentHandlerBase extends AbstractHandler { * @param event An event containing all the information about the current state of the application. * @return The generic text editor, or {@code null}. */ - protected GenericTextEditor getTextEditor(ExecutionEvent event) { + protected GenericTextEditor getTextEditor(ExecutionEvent event) { // Get generic text editor. IWorkbenchPart part = HandlerUtil.getActivePart(event); Assert.notNull(part); Assert.check(part.getAdapter(TextEditor.class) != null); - GenericTextEditor editor = null; + GenericTextEditor editor = null; if (part instanceof GenericTextEditor) { - editor = (GenericTextEditor)part; + editor = (GenericTextEditor)part; } else { Object obj = part.getAdapter(GenericTextEditor.class); - editor = (GenericTextEditor)obj; + editor = (GenericTextEditor)obj; } if (editor == null) { @@ -90,7 +90,7 @@ public abstract class CommentHandlerBase extends AbstractHandler { * @return The single line comment characters, or {@code null}. * @see GenericTextEditor#singleLineCommentChars */ - protected String getCommentChars(ExecutionEvent event, GenericTextEditor editor) { + protected String getCommentChars(ExecutionEvent event, GenericTextEditor editor) { String chars = editor.singleLineCommentChars; if (chars == null) { IWorkbenchPart part = HandlerUtil.getActivePart(event); @@ -112,7 +112,7 @@ public abstract class CommentHandlerBase extends AbstractHandler { * @param editor The text editor for which to return the document. * @return The document of the editor. */ - protected IDocument getDocument(ExecutionEvent event, GenericTextEditor editor) { + protected IDocument getDocument(ExecutionEvent event, GenericTextEditor editor) { IEditorInput input = HandlerUtil.getActiveEditorInput(event); Assert.notNull(input); IDocument doc = editor.getDocumentProvider().getDocument(input); @@ -126,7 +126,7 @@ public abstract class CommentHandlerBase extends AbstractHandler { * @param editor The text editor for which to return the currently active text selection. * @return The currently active text selection of the editor. */ - protected ITextSelection getSelection(GenericTextEditor editor) { + protected ITextSelection getSelection(GenericTextEditor editor) { // Don't obtain it using HandlerUtil, as it doesn't give the correct // selection. ISelection selection = editor.getSelectionProvider().getSelection(); diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/UncommentHandler.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/UncommentHandler.java index e55d56572..62da6e2c4 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/UncommentHandler.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/commands/UncommentHandler.java @@ -36,7 +36,7 @@ public class UncommentHandler extends CommentHandlerBase { @Override public Object execute(ExecutionEvent event) throws ExecutionException { // Get generic text editor. - GenericTextEditor editor = getTextEditor(event); + GenericTextEditor editor = getTextEditor(event); if (editor == null) { return null; } diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java new file mode 100644 index 000000000..f93095d81 --- /dev/null +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java @@ -0,0 +1,62 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.setext.texteditorbase.themes; + +import org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine; +import org.eclipse.e4.ui.css.swt.theme.ITheme; +import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.ui.PlatformUI; + +/** + * A text editor that automatically uses a dark theme or light theme, depending on the theme currently used by Eclipse. + * + *

+ * This theme only recognizes and supports built-in Eclipse themes. Any custom dark theme will thus not be detected as a + * dark theme, but as a light theme. + *

+ * + * @param The enum with the named styles of a text editor. + */ +@SuppressWarnings("restriction") +public class AutoDarkLightTheme implements TextEditorTheme { + /** The dark or light theme to use. */ + private final TextEditorTheme theme; + + /** + * Constructor for the {@link AutoDarkLightTheme} class. + * + * @param darkTheme The dark theme to use. + * @param lightTheme The light them to use. + */ + public AutoDarkLightTheme(TextEditorTheme darkTheme, TextEditorTheme lightTheme) { + theme = isDarkThemeInUse() ? darkTheme : lightTheme; + } + + /** + * Returns whether the current Eclipse theme is a dark theme. + * + * @return {@code true} if the current Eclipse theme is a dark theme, {@code false} otherwise. + */ + private boolean isDarkThemeInUse() { + IThemeEngine themeEngine = PlatformUI.getWorkbench().getService(IThemeEngine.class); + ITheme theme = themeEngine.getActiveTheme(); + return theme != null && theme.getId().equals(ThemeEngine.E4_DARK_THEME_ID); + } + + @Override + public Style getStyle(T namedStyle) { + return theme.getStyle(namedStyle); + } +} diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/DefaultTextEditorThemeNames.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/DefaultTextEditorThemeNames.java new file mode 100644 index 000000000..e969f2f2c --- /dev/null +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/DefaultTextEditorThemeNames.java @@ -0,0 +1,26 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.setext.texteditorbase.themes; + +/** Names of the default text editor themes. */ +public interface DefaultTextEditorThemeNames { + /** Automatic dark/light theme. */ + public static final String AUTO = "auto"; + + /** Dark theme. */ + public static final String DARK = "dark"; + + /** Light theme. */ + public static final String LIGHT = "light"; +} diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/TextEditorTheme.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/TextEditorTheme.java new file mode 100644 index 000000000..238cbeb86 --- /dev/null +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/TextEditorTheme.java @@ -0,0 +1,31 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.setext.texteditorbase.themes; + +import org.eclipse.escet.setext.texteditorbase.Style; + +/** + * A text editor theme. + * + * @param The enum with the named styles of a text editor. + */ +public interface TextEditorTheme { + /** + * Returns the themed style for a given named style. + * + * @param namedStyle The named style. + * @return The themed style. + */ + public Style getStyle(T namedStyle); +} -- GitLab From 18ede9ebb015563e2e49335d940869a01f379cac Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 4 Sep 2022 15:57:15 +0200 Subject: [PATCH 02/51] #347 Add dark/light theme support to CIF text editor. --- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 9 +++ .../cif/texteditor/CifCodeHighlighter.java | 15 ++++- .../cif/texteditor/CifSourceViewerConfig.java | 29 ++++++++-- .../escet/cif/texteditor/CifStyles.java | 47 ---------------- .../escet/cif/texteditor/CifTextEditor.java | 5 +- .../texteditor/CifTextEditorDarkTheme.java | 54 ++++++++++++++++++ .../texteditor/CifTextEditorLightTheme.java | 54 ++++++++++++++++++ .../CifTextEditorPreferencePage.java | 21 +++++++ .../cif/texteditor/CifTextEditorScanner.java | 38 ++++++++----- .../texteditor/CifTextEditorStyleNames.java | 56 +++++++++++++++++++ 11 files changed, 262 insertions(+), 69 deletions(-) delete mode 100644 cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifStyles.java create mode 100644 cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java create mode 100644 cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorLightTheme.java create mode 100644 cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorPreferencePage.java create mode 100644 cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStyleNames.java diff --git a/cif/org.eclipse.escet.cif.texteditor/META-INF/MANIFEST.MF b/cif/org.eclipse.escet.cif.texteditor/META-INF/MANIFEST.MF index 8ce246e5c..723a94101 100644 --- a/cif/org.eclipse.escet.cif.texteditor/META-INF/MANIFEST.MF +++ b/cif/org.eclipse.escet.cif.texteditor/META-INF/MANIFEST.MF @@ -19,6 +19,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.17.0", org.eclipse.escet.cif.metamodel;bundle-version="0.7.0", org.eclipse.escet.setext.runtime;bundle-version="0.7.0", org.apache.commons.lang3;bundle-version="3.1.0", - org.eclipse.escet.setext.texteditorbase;bundle-version="0.7.0" + org.eclipse.escet.setext.texteditorbase;bundle-version="0.7.0", + org.eclipse.ui.ide;bundle-version="3.18.200" Export-Package: org.eclipse.escet.cif.texteditor Automatic-Module-Name: org.eclipse.escet.cif.texteditor diff --git a/cif/org.eclipse.escet.cif.texteditor/plugin.xml b/cif/org.eclipse.escet.cif.texteditor/plugin.xml index e93df842e..e93407895 100644 --- a/cif/org.eclipse.escet.cif.texteditor/plugin.xml +++ b/cif/org.eclipse.escet.cif.texteditor/plugin.xml @@ -39,4 +39,13 @@ + + + + + diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifCodeHighlighter.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifCodeHighlighter.java index c22a4da04..c875ed90f 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifCodeHighlighter.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifCodeHighlighter.java @@ -15,13 +15,26 @@ package org.eclipse.escet.cif.texteditor; import org.eclipse.escet.setext.texteditorbase.highlight.CodeHighlighter; import org.eclipse.escet.setext.texteditorbase.scanners.GenericPartitionScanner; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.presentation.IPresentationReconciler; /** CIF code highlighter. */ public class CifCodeHighlighter extends CodeHighlighter { + /** The theme to use. */ + private final TextEditorTheme theme; + + /** + * Constructor for the {@link CifCodeHighlighter} class. + * + * @param theme The theme to use. + */ + public CifCodeHighlighter(TextEditorTheme theme) { + this.theme = theme; + } + @Override protected IPresentationReconciler obtainPresentationReconciler() { - CifSourceViewerConfig config = new CifSourceViewerConfig(); + CifSourceViewerConfig config = new CifSourceViewerConfig(theme); config.setColorManager(colorManager); return config.getPresentationReconciler(null); } diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifSourceViewerConfig.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifSourceViewerConfig.java index 95b85d649..ab6a99845 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifSourceViewerConfig.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifSourceViewerConfig.java @@ -13,31 +13,50 @@ package org.eclipse.escet.cif.texteditor; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.COMMENT_ML; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.COMMENT_SL; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.STRING; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.STRING_ESCAPE; + import org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration; import org.eclipse.escet.setext.texteditorbase.scanners.FormatStringScanner; import org.eclipse.escet.setext.texteditorbase.scanners.SingleStyleScanner; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.presentation.PresentationReconciler; import org.eclipse.jface.text.rules.ITokenScanner; /** CIF text editor source viewer configuration. */ public class CifSourceViewerConfig extends GenericSourceViewerConfiguration { + /** The theme to use. */ + private final TextEditorTheme theme; + + /** + * Constructor for the {@link CifSourceViewerConfig} class. + * + * @param theme The theme to use. + */ + public CifSourceViewerConfig(TextEditorTheme theme) { + this.theme = theme; + } + @Override protected void addDamagersRepairers(PresentationReconciler reconciler) { // DEFAULT. - ITokenScanner scanner = new CifTextEditorScanner(colorManager); + ITokenScanner scanner = new CifTextEditorScanner(theme, colorManager); addDamagerRepairer(reconciler, scanner, DEFAULT_CONTENT_TYPE); // COMMENT_ML. - ITokenScanner commentMlScanner = new SingleStyleScanner(CifStyles.COMMENT_ML.createToken(colorManager)); + ITokenScanner commentMlScanner = new SingleStyleScanner(theme.getStyle(COMMENT_ML).createToken(colorManager)); addDamagerRepairer(reconciler, commentMlScanner, "__cif_comment_ml"); // COMMENT_SL. - ITokenScanner commentSlScanner = new SingleStyleScanner(CifStyles.COMMENT_SL.createToken(colorManager)); + ITokenScanner commentSlScanner = new SingleStyleScanner(theme.getStyle(COMMENT_SL).createToken(colorManager)); addDamagerRepairer(reconciler, commentSlScanner, "__cif_comment_sl"); // STRING (string literals, paths, format patterns, etc). - ITokenScanner stringScanner = new FormatStringScanner(CifStyles.STRING.createToken(colorManager), - CifStyles.STRING_ESCAPE.createToken(colorManager), CifStyles.STRING_ESCAPE.createToken(colorManager)); + ITokenScanner stringScanner = new FormatStringScanner(theme.getStyle(STRING).createToken(colorManager), + theme.getStyle(STRING_ESCAPE).createToken(colorManager), + theme.getStyle(STRING_ESCAPE).createToken(colorManager)); addDamagerRepairer(reconciler, stringScanner, "__cif_string"); } } diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifStyles.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifStyles.java deleted file mode 100644 index 24cf9376e..000000000 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifStyles.java +++ /dev/null @@ -1,47 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation -// -// See the NOTICE file(s) distributed with this work for additional -// information regarding copyright ownership. -// -// This program and the accompanying materials are made available -// under the terms of the MIT License which is available at -// https://opensource.org/licenses/MIT -// -// SPDX-License-Identifier: MIT -////////////////////////////////////////////////////////////////////////////// - -package org.eclipse.escet.cif.texteditor; - -import org.eclipse.escet.setext.texteditorbase.Style; -import org.eclipse.swt.SWT; - -/** Styles for the CIF text editor. */ -@SuppressWarnings("javadoc") -public interface CifStyles { - Style DEFAULT = new Style(64, 32, 32); - - Style IDENTIFIER = new Style(0, 0, 0); - - Style COMMENT_SL = new Style(128, 128, 128, SWT.ITALIC); - - Style COMMENT_ML = new Style(128, 128, 128, SWT.ITALIC); - - Style STRING = new Style(192, 0, 0); - - Style STRING_ESCAPE = new Style(255, 128, 0); - - Style KEYWORD = new Style(0, 0, 255); - - Style STDLIBFUNC = new Style(128, 0, 255); - - Style OPERATOR = new Style(0, 97, 192); - - Style NUMBER = new Style(0, 97, 0); - - Style C_EVENT = new Style(0, 97, 0); - - Style U_EVENT = new Style(128, 0, 0); - - Style E_EVENT = new Style(192, 97, 0); -} diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditor.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditor.java index bfd11ed58..d84fac609 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditor.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditor.java @@ -20,10 +20,11 @@ import org.eclipse.escet.cif.typechecker.CifTypeChecker; import org.eclipse.escet.setext.texteditorbase.GenericTextEditor; /** CIF text editor for Eclipse. */ -public class CifTextEditor extends GenericTextEditor { +public class CifTextEditor extends GenericTextEditor { /** Constructor for the {@link CifTextEditor} class. */ public CifTextEditor() { - super(new CifPartitionScanner(), new CifSourceViewerConfig(), CifParser.class, CifTypeChecker.class, + super(new CifPartitionScanner(), theme -> new CifSourceViewerConfig(theme), new CifTextEditorDarkTheme(), + new CifTextEditorLightTheme(), CifParser.class, CifTypeChecker.class, "org.eclipse.escet.cif.texteditor.CifSyntaxProblem", "org.eclipse.escet.cif.texteditor.CifSemanticProblem", "//"); } diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java new file mode 100644 index 000000000..a14b042e2 --- /dev/null +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java @@ -0,0 +1,54 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.texteditor; + +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; +import org.eclipse.swt.SWT; + +/** CIF text editor dark theme. */ +public class CifTextEditorDarkTheme implements TextEditorTheme { + @Override + public Style getStyle(CifTextEditorStyleNames namedStyle) { + switch (namedStyle) { + case DEFAULT: + return new Style(240, 240, 240); + case IDENTIFIER: + return new Style(240, 240, 240); + case COMMENT_SL: + return new Style(160, 160, 160, SWT.ITALIC); + case COMMENT_ML: + return new Style(160, 160, 160, SWT.ITALIC); + case STRING: + return new Style(235, 64, 64); + case STRING_ESCAPE: + return new Style(235, 150, 40); + case KEYWORD: + return new Style(0, 164, 255); + case STDLIBFUNC: + return new Style(210, 110, 255); + case OPERATOR: + return new Style(64, 210, 210); + case NUMBER: + return new Style(24, 225, 24); + case C_EVENT: + return new Style(24, 225, 24); + case U_EVENT: + return new Style(245, 90, 90); + case E_EVENT: + return new Style(225, 145, 78); + } + throw new AssertionError(); + } +} diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorLightTheme.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorLightTheme.java new file mode 100644 index 000000000..e0ffe5482 --- /dev/null +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorLightTheme.java @@ -0,0 +1,54 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.texteditor; + +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; +import org.eclipse.swt.SWT; + +/** CIF text editor light theme. */ +public class CifTextEditorLightTheme implements TextEditorTheme { + @Override + public Style getStyle(CifTextEditorStyleNames namedStyle) { + switch (namedStyle) { + case DEFAULT: + return new Style(0, 0, 0); + case IDENTIFIER: + return new Style(0, 0, 0); + case COMMENT_SL: + return new Style(128, 128, 128, SWT.ITALIC); + case COMMENT_ML: + return new Style(128, 128, 128, SWT.ITALIC); + case STRING: + return new Style(192, 0, 0); + case STRING_ESCAPE: + return new Style(255, 128, 0); + case KEYWORD: + return new Style(0, 0, 255); + case STDLIBFUNC: + return new Style(128, 0, 255); + case OPERATOR: + return new Style(0, 97, 192); + case NUMBER: + return new Style(0, 97, 0); + case C_EVENT: + return new Style(0, 97, 0); + case U_EVENT: + return new Style(128, 0, 0); + case E_EVENT: + return new Style(192, 97, 0); + } + throw new AssertionError(); + } +} diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorPreferencePage.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorPreferencePage.java new file mode 100644 index 000000000..fc3ea4b5c --- /dev/null +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorPreferencePage.java @@ -0,0 +1,21 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.texteditor; + +import org.eclipse.escet.setext.texteditorbase.GenericTextEditorPreferencePage; + +/** CIF text editor preference page. */ +public class CifTextEditorPreferencePage extends GenericTextEditorPreferencePage { + // Base class provides all functionality. +} diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorScanner.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorScanner.java index 9ea7ab93f..30f5b8c32 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorScanner.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorScanner.java @@ -13,6 +13,15 @@ package org.eclipse.escet.cif.texteditor; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.C_EVENT; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.DEFAULT; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.E_EVENT; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.IDENTIFIER; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.KEYWORD; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.NUMBER; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.OPERATOR; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.STDLIBFUNC; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.U_EVENT; import static org.eclipse.escet.common.java.Strings.fmt; import org.apache.commons.lang3.ArrayUtils; @@ -24,6 +33,7 @@ import org.eclipse.escet.setext.texteditorbase.rules.IntNumberRule; import org.eclipse.escet.setext.texteditorbase.rules.KeywordsRule; import org.eclipse.escet.setext.texteditorbase.rules.LiteralsRule; import org.eclipse.escet.setext.texteditorbase.rules.RegExRule; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.WhitespaceRule; @@ -32,9 +42,10 @@ public class CifTextEditorScanner extends RuleBasedScannerEx { /** * Constructor for the {@link CifTextEditorScanner} class. * + * @param theme The theme to use. * @param manager The color manager to use to create the color tokens. */ - public CifTextEditorScanner(ColorManager manager) { + public CifTextEditorScanner(TextEditorTheme theme, ColorManager manager) { // Keywords copied from CIF scanner. String[] keywords = CifScanner.getKeywords("Keywords"); String[] supKinds = CifScanner.getKeywords("SupKind"); @@ -69,20 +80,21 @@ public class CifTextEditorScanner extends RuleBasedScannerEx { // Construct and set predicate rules. Make sure we also have a default // token. IRule[] rules = new IRule[] { // - new KeywordsRule(keywords, CifStyles.KEYWORD.createToken(manager)), // - new KeywordsRule(stdlibfuncs, CifStyles.STDLIBFUNC.createToken(manager)), // - new KeywordsRule(operators, CifStyles.OPERATOR.createToken(manager)), // - new LiteralsRule(literals, CifStyles.DEFAULT.createToken(manager)), // - new RegExRule(uNamePat, CifStyles.U_EVENT.createToken(manager)), // - new RegExRule(cNamePat, CifStyles.C_EVENT.createToken(manager)), // - new RegExRule(eNamePat, CifStyles.E_EVENT.createToken(manager)), // - new RegExRule(namePat, CifStyles.IDENTIFIER.createToken(manager)), // - new RegExRule(realPat, CifStyles.NUMBER.createToken(manager)), // - new IntNumberRule(CifStyles.NUMBER.createToken(manager)), // - new WhitespaceRule(new GenericWhitespaceDetector()), // + new KeywordsRule(keywords, theme.getStyle(KEYWORD).createToken(manager)), + new KeywordsRule(stdlibfuncs, theme.getStyle(STDLIBFUNC).createToken(manager)), + new KeywordsRule(operators, theme.getStyle(OPERATOR).createToken(manager)), + new LiteralsRule(literals, theme.getStyle(DEFAULT).createToken(manager)), + new RegExRule(uNamePat, theme.getStyle(U_EVENT).createToken(manager)), + new RegExRule(cNamePat, theme.getStyle(C_EVENT).createToken(manager)), + new RegExRule(eNamePat, theme.getStyle(E_EVENT).createToken(manager)), + new RegExRule(namePat, theme.getStyle(IDENTIFIER).createToken(manager)), + new RegExRule(realPat, theme.getStyle(NUMBER).createToken(manager)), + new IntNumberRule(theme.getStyle(NUMBER).createToken(manager)), + new WhitespaceRule(new GenericWhitespaceDetector()), + // }; setRules(rules); - setDefaultReturnToken(CifStyles.DEFAULT.createToken(manager)); + setDefaultReturnToken(theme.getStyle(DEFAULT).createToken(manager)); } } diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStyleNames.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStyleNames.java new file mode 100644 index 000000000..92df6ca8b --- /dev/null +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStyleNames.java @@ -0,0 +1,56 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.texteditor; + +/** CIF text editor style names. */ +public enum CifTextEditorStyleNames { + /** Default style. */ + DEFAULT, + + /** Identifier style. */ + IDENTIFIER, + + /** Single-line comment style. */ + COMMENT_SL, + + /** Multi-line comment style. */ + COMMENT_ML, + + /** String literal style. */ + STRING, + + /** String literal escape sequence style. */ + STRING_ESCAPE, + + /** Keyword style. */ + KEYWORD, + + /** Standard library function style. */ + STDLIBFUNC, + + /** Operator style. */ + OPERATOR, + + /** Number literal style. */ + NUMBER, + + /** Controllable event name style. */ + C_EVENT, + + /** Uncontrollable event name style. */ + U_EVENT, + + /** Event name style. */ + E_EVENT, +} -- GitLab From 1ad3afeac909fb137ee062ac55270b0a66c9e64a Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 4 Sep 2022 16:07:12 +0200 Subject: [PATCH 03/51] #347 Added light/dark theme support to Chi text editor. --- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 9 ++++ .../chi/texteditor/ChiSourceViewerConfig.java | 26 +++++++++-- .../escet/chi/texteditor/ChiTextEditor.java | 5 +- .../texteditor/ChiTextEditorDarkTheme.java | 46 +++++++++++++++++++ .../texteditor/ChiTextEditorLightTheme.java | 46 +++++++++++++++++++ .../ChiTextEditorPreferencePage.java | 21 +++++++++ ...yles.java => ChiTextEditorStyleNames.java} | 33 ++++++------- .../escet/chi/texteditor/ChiTextScanner.java | 25 ++++++---- 9 files changed, 181 insertions(+), 33 deletions(-) create mode 100644 chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java create mode 100644 chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorLightTheme.java create mode 100644 chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorPreferencePage.java rename chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/{ChiStyles.java => ChiTextEditorStyleNames.java} (50%) diff --git a/chi/org.eclipse.escet.chi.texteditor/META-INF/MANIFEST.MF b/chi/org.eclipse.escet.chi.texteditor/META-INF/MANIFEST.MF index 40e26e1a0..e9a2574f0 100644 --- a/chi/org.eclipse.escet.chi.texteditor/META-INF/MANIFEST.MF +++ b/chi/org.eclipse.escet.chi.texteditor/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.escet.chi.parser;bundle-version="0.7.0", org.eclipse.ui.editors;bundle-version="3.13.0", org.eclipse.escet.setext.texteditorbase;bundle-version="0.7.0", org.eclipse.escet.setext.runtime;bundle-version="0.7.0", - org.eclipse.escet.common.java;bundle-version="0.7.0" + org.eclipse.escet.common.java;bundle-version="0.7.0", + org.eclipse.ui.ide;bundle-version="3.18.200" Automatic-Module-Name: org.eclipse.escet.chi.texteditor Export-Package: org.eclipse.escet.chi.texteditor diff --git a/chi/org.eclipse.escet.chi.texteditor/plugin.xml b/chi/org.eclipse.escet.chi.texteditor/plugin.xml index 654781b32..49cf0039c 100644 --- a/chi/org.eclipse.escet.chi.texteditor/plugin.xml +++ b/chi/org.eclipse.escet.chi.texteditor/plugin.xml @@ -39,4 +39,13 @@ + + + + + diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiSourceViewerConfig.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiSourceViewerConfig.java index cbe091757..e4b9e5641 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiSourceViewerConfig.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiSourceViewerConfig.java @@ -13,27 +13,45 @@ package org.eclipse.escet.chi.texteditor; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.COMMENT_SL; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.STRING; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.STRING_ESCAPE; + import org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration; import org.eclipse.escet.setext.texteditorbase.scanners.FormatStringScanner; import org.eclipse.escet.setext.texteditorbase.scanners.SingleStyleScanner; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.presentation.PresentationReconciler; import org.eclipse.jface.text.rules.ITokenScanner; /** Chi text editor source viewer configuration. */ public class ChiSourceViewerConfig extends GenericSourceViewerConfiguration { + /** The theme to use. */ + private final TextEditorTheme theme; + + /** + * Constructor for the {@link ChiSourceViewerConfig} class. + * + * @param theme The theme to use. + */ + public ChiSourceViewerConfig(TextEditorTheme theme) { + this.theme = theme; + } + @Override protected void addDamagersRepairers(PresentationReconciler reconciler) { // DEFAULT. - ITokenScanner scanner = new ChiTextScanner(colorManager); + ITokenScanner scanner = new ChiTextScanner(theme, colorManager); addDamagerRepairer(reconciler, scanner, DEFAULT_CONTENT_TYPE); // COMMENT_SL. - ITokenScanner commentSlScanner = new SingleStyleScanner(ChiStyles.COMMENT_SL.createToken(colorManager)); + ITokenScanner commentSlScanner = new SingleStyleScanner(theme.getStyle(COMMENT_SL).createToken(colorManager)); addDamagerRepairer(reconciler, commentSlScanner, "__chi_comment_sl"); // STRING (string literals, paths, format patterns, etc). - ITokenScanner stringScanner = new FormatStringScanner(ChiStyles.STRING.createToken(colorManager), - ChiStyles.STRING_ESCAPE.createToken(colorManager), ChiStyles.STRING_ESCAPE.createToken(colorManager)); + ITokenScanner stringScanner = new FormatStringScanner(theme.getStyle(STRING).createToken(colorManager), + theme.getStyle(STRING_ESCAPE).createToken(colorManager), + theme.getStyle(STRING_ESCAPE).createToken(colorManager)); addDamagerRepairer(reconciler, stringScanner, "__chi_string"); } } diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditor.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditor.java index fd0c4c0d0..d58344c45 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditor.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditor.java @@ -22,10 +22,11 @@ import org.eclipse.escet.chi.typecheck.ChiTypeChecker; import org.eclipse.escet.setext.texteditorbase.GenericTextEditor; /** Chi text editor for Eclipse. */ -public class ChiTextEditor extends GenericTextEditor, Specification> { +public class ChiTextEditor extends GenericTextEditor, Specification, ChiTextEditorStyleNames> { /** Constructor for the {@link ChiTextEditor} class. */ public ChiTextEditor() { - super(new ChiPartitionScanner(), new ChiSourceViewerConfig(), ChiParser.class, ChiTypeChecker.class, + super(new ChiPartitionScanner(), theme -> new ChiSourceViewerConfig(theme), new ChiTextEditorDarkTheme(), + new ChiTextEditorLightTheme(), ChiParser.class, ChiTypeChecker.class, "org.eclipse.escet.chi.texteditor.ChiSyntaxError", "org.eclipse.escet.chi.texteditor.ChiSemanticError", "#"); } diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java new file mode 100644 index 000000000..942447783 --- /dev/null +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java @@ -0,0 +1,46 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.chi.texteditor; + +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; +import org.eclipse.swt.SWT; + +/** Chi text editor dark theme. */ +public class ChiTextEditorDarkTheme implements TextEditorTheme { + @Override + public Style getStyle(ChiTextEditorStyleNames namedStyle) { + switch (namedStyle) { + case DEFAULT: + return new Style(240, 240, 240); + case IDENTIFIER: + return new Style(240, 240, 240); + case COMMENT_SL: + return new Style(160, 160, 160, SWT.ITALIC); + case STRING: + return new Style(235, 64, 64); + case STRING_ESCAPE: + return new Style(235, 150, 40); + case KEYWORD: + return new Style(0, 164, 255); + case STDLIBFUNC: + return new Style(210, 110, 255); + case OPERATOR: + return new Style(64, 210, 210); + case NUMBER: + return new Style(24, 225, 24); + } + throw new AssertionError(); + } +} diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorLightTheme.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorLightTheme.java new file mode 100644 index 000000000..bbc520fd4 --- /dev/null +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorLightTheme.java @@ -0,0 +1,46 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.chi.texteditor; + +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; +import org.eclipse.swt.SWT; + +/** Chi text editor light theme. */ +public class ChiTextEditorLightTheme implements TextEditorTheme { + @Override + public Style getStyle(ChiTextEditorStyleNames namedStyle) { + switch (namedStyle) { + case DEFAULT: + return new Style(0, 0, 0); + case IDENTIFIER: + return new Style(0, 0, 0); + case COMMENT_SL: + return new Style(128, 128, 128, SWT.ITALIC); + case STRING: + return new Style(192, 0, 0); + case STRING_ESCAPE: + return new Style(255, 128, 0); + case KEYWORD: + return new Style(0, 0, 255); + case STDLIBFUNC: + return new Style(128, 0, 255); + case OPERATOR: + return new Style(0, 97, 192); + case NUMBER: + return new Style(0, 97, 0); + } + throw new AssertionError(); + } +} diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorPreferencePage.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorPreferencePage.java new file mode 100644 index 000000000..92cf648d5 --- /dev/null +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorPreferencePage.java @@ -0,0 +1,21 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.chi.texteditor; + +import org.eclipse.escet.setext.texteditorbase.GenericTextEditorPreferencePage; + +/** Chi text editor preference page. */ +public class ChiTextEditorPreferencePage extends GenericTextEditorPreferencePage { + // Base class provides all functionality. +} diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiStyles.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStyleNames.java similarity index 50% rename from chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiStyles.java rename to chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStyleNames.java index 561a2e349..fb36a0b5d 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiStyles.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStyleNames.java @@ -13,35 +13,32 @@ package org.eclipse.escet.chi.texteditor; -import org.eclipse.escet.setext.texteditorbase.Style; -import org.eclipse.swt.SWT; - -/** Styles for the Chi text editor. */ -public interface ChiStyles { +/** Chi text editor style names. */ +public enum ChiTextEditorStyleNames { /** Default style. */ - Style DEFAULT = new Style(64, 32, 32); + DEFAULT, - /** Identifiers style. */ - Style IDENTIFIER = new Style(0, 0, 0); + /** Identifier style. */ + IDENTIFIER, - /** Single line comment style. */ - Style COMMENT_SL = new Style(128, 128, 128, SWT.ITALIC); + /** Single-line comment style. */ + COMMENT_SL, /** String literal style. */ - Style STRING = new Style(192, 0, 0); + STRING, - /** String literal escape style. */ - Style STRING_ESCAPE = new Style(255, 128, 0); + /** String literal escape sequence style. */ + STRING_ESCAPE, /** Keyword style. */ - Style KEYWORD = new Style(0, 0, 255); + KEYWORD, - /** Standard library function keyword style. */ - Style STDLIBFUNC = new Style(128, 0, 255); + /** Standard library function style. */ + STDLIBFUNC, /** Operator style. */ - Style OPERATOR = new Style(0, 97, 192); + OPERATOR, /** Number literal style. */ - Style NUMBER = new Style(0, 97, 0); + NUMBER, } diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextScanner.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextScanner.java index 427d0d6a6..ac57edbf9 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextScanner.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextScanner.java @@ -13,6 +13,13 @@ package org.eclipse.escet.chi.texteditor; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.DEFAULT; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.IDENTIFIER; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.KEYWORD; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.NUMBER; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.OPERATOR; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.STDLIBFUNC; + import org.eclipse.escet.chi.parser.ChiScanner; import org.eclipse.escet.setext.texteditorbase.ColorManager; import org.eclipse.escet.setext.texteditorbase.detectors.GenericWhitespaceDetector; @@ -20,6 +27,7 @@ import org.eclipse.escet.setext.texteditorbase.rules.IdentifiersRule; import org.eclipse.escet.setext.texteditorbase.rules.IntNumberRule; import org.eclipse.escet.setext.texteditorbase.rules.KeywordsRule; import org.eclipse.escet.setext.texteditorbase.rules.RealNumberRule; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.RuleBasedScanner; import org.eclipse.jface.text.rules.WhitespaceRule; @@ -29,9 +37,10 @@ public class ChiTextScanner extends RuleBasedScanner { /** * Constructor for the {@link ChiScanner} class. * + * @param theme The theme to use. * @param manager The color manager to use to create the color tokens. */ - public ChiTextScanner(ColorManager manager) { + public ChiTextScanner(TextEditorTheme theme, ColorManager manager) { String[] keywords = ChiScanner.getKeywords("Keywords"); String[] types = ChiScanner.getKeywords("Types"); String[] constants = ChiScanner.getKeywords("Constants"); @@ -50,17 +59,17 @@ public class ChiTextScanner extends RuleBasedScanner { // Construct and set predicate rules. Make sure we also have a default // token. IRule[] rules = new IRule[] { // - new KeywordsRule(allKeywords, ChiStyles.KEYWORD.createToken(manager)), - new KeywordsRule(stdlibfuncs, ChiStyles.STDLIBFUNC.createToken(manager)), - new KeywordsRule(operators, ChiStyles.OPERATOR.createToken(manager)), - new IdentifiersRule(ChiStyles.IDENTIFIER.createToken(manager)), - new RealNumberRule(ChiStyles.NUMBER.createToken(manager)), - new IntNumberRule(ChiStyles.NUMBER.createToken(manager)), + new KeywordsRule(allKeywords, theme.getStyle(KEYWORD).createToken(manager)), + new KeywordsRule(stdlibfuncs, theme.getStyle(STDLIBFUNC).createToken(manager)), + new KeywordsRule(operators, theme.getStyle(OPERATOR).createToken(manager)), + new IdentifiersRule(theme.getStyle(IDENTIFIER).createToken(manager)), + new RealNumberRule(theme.getStyle(NUMBER).createToken(manager)), + new IntNumberRule(theme.getStyle(NUMBER).createToken(manager)), new WhitespaceRule(new GenericWhitespaceDetector()), // }; setRules(rules); - setDefaultReturnToken(ChiStyles.DEFAULT.createToken(manager)); + setDefaultReturnToken(theme.getStyle(DEFAULT).createToken(manager)); } } -- GitLab From 5ab7e34176ad1bb28868b74c4d6296f90b8b95b6 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 4 Sep 2022 16:14:59 +0200 Subject: [PATCH 04/51] #347 Added dark/light theme support to ToolDef text editor. --- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 9 ++++ .../texteditor/ToolDefSourceViewerConfig.java | 30 +++++++++--- .../tooldef/texteditor/ToolDefStyles.java | 41 ---------------- .../tooldef/texteditor/ToolDefTextEditor.java | 5 +- .../ToolDefTextEditorDarkTheme.java | 48 +++++++++++++++++++ .../ToolDefTextEditorLightTheme.java | 48 +++++++++++++++++++ .../ToolDefTextEditorPreferencePage.java | 21 ++++++++ .../texteditor/ToolDefTextEditorScanner.java | 27 +++++++---- .../ToolDefTextEditorStyleNames.java | 47 ++++++++++++++++++ 10 files changed, 220 insertions(+), 59 deletions(-) delete mode 100644 tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefStyles.java create mode 100644 tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorDarkTheme.java create mode 100644 tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorLightTheme.java create mode 100644 tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorPreferencePage.java create mode 100644 tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorStyleNames.java diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/META-INF/MANIFEST.MF b/tooldef/org.eclipse.escet.tooldef.texteditor/META-INF/MANIFEST.MF index 66740f4f1..05f0702ab 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/META-INF/MANIFEST.MF +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/META-INF/MANIFEST.MF @@ -18,6 +18,7 @@ Require-Bundle: org.eclipse.escet.tooldef.metamodel;bundle-version="0.7.0", org.eclipse.ui.editors;bundle-version="3.13.0", org.eclipse.escet.common.java;bundle-version="0.7.0", org.apache.commons.lang3;bundle-version="3.1.0", - org.eclipse.escet.tooldef.typechecker;bundle-version="0.7.0" + org.eclipse.escet.tooldef.typechecker;bundle-version="0.7.0", + org.eclipse.ui.ide;bundle-version="3.18.200" Automatic-Module-Name: org.eclipse.escet.tooldef.texteditor Export-Package: org.eclipse.escet.tooldef.texteditor diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/plugin.xml b/tooldef/org.eclipse.escet.tooldef.texteditor/plugin.xml index 91dd79ca2..834b70e02 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/plugin.xml +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/plugin.xml @@ -39,4 +39,13 @@ + + + + + diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefSourceViewerConfig.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefSourceViewerConfig.java index 36a492586..b20dfc28d 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefSourceViewerConfig.java +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefSourceViewerConfig.java @@ -13,32 +13,50 @@ package org.eclipse.escet.tooldef.texteditor; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.COMMENT_ML; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.COMMENT_SL; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.STRING; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.STRING_ESCAPE; + import org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration; import org.eclipse.escet.setext.texteditorbase.scanners.FormatStringScanner; import org.eclipse.escet.setext.texteditorbase.scanners.SingleStyleScanner; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.presentation.PresentationReconciler; import org.eclipse.jface.text.rules.ITokenScanner; /** ToolDef text editor source viewer configuration. */ public class ToolDefSourceViewerConfig extends GenericSourceViewerConfiguration { + /** The theme to use. */ + private final TextEditorTheme theme; + + /** + * Constructor for the {@link ToolDefSourceViewerConfig} class. + * + * @param theme The theme to use. + */ + public ToolDefSourceViewerConfig(TextEditorTheme theme) { + this.theme = theme; + } + @Override protected void addDamagersRepairers(PresentationReconciler reconciler) { // DEFAULT. - ITokenScanner scanner = new ToolDefTextEditorScanner(colorManager); + ITokenScanner scanner = new ToolDefTextEditorScanner(theme, colorManager); addDamagerRepairer(reconciler, scanner, DEFAULT_CONTENT_TYPE); // COMMENT_ML. - ITokenScanner commentMlScanner = new SingleStyleScanner(ToolDefStyles.COMMENT_ML.createToken(colorManager)); + ITokenScanner commentMlScanner = new SingleStyleScanner(theme.getStyle(COMMENT_ML).createToken(colorManager)); addDamagerRepairer(reconciler, commentMlScanner, "__tooldef_comment_ml"); // COMMENT_SL. - ITokenScanner commentSlScanner = new SingleStyleScanner(ToolDefStyles.COMMENT_SL.createToken(colorManager)); + ITokenScanner commentSlScanner = new SingleStyleScanner(theme.getStyle(COMMENT_SL).createToken(colorManager)); addDamagerRepairer(reconciler, commentSlScanner, "__tooldef_comment_sl"); // STRING (string literals, paths, format patterns, etc). - ITokenScanner stringScanner = new FormatStringScanner(ToolDefStyles.STRING.createToken(colorManager), - ToolDefStyles.STRING_ESCAPE.createToken(colorManager), - ToolDefStyles.STRING_ESCAPE.createToken(colorManager)); + ITokenScanner stringScanner = new FormatStringScanner(theme.getStyle(STRING).createToken(colorManager), + theme.getStyle(STRING_ESCAPE).createToken(colorManager), + theme.getStyle(STRING_ESCAPE).createToken(colorManager)); addDamagerRepairer(reconciler, stringScanner, "__tooldef_string"); } } diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefStyles.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefStyles.java deleted file mode 100644 index 922aa240c..000000000 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefStyles.java +++ /dev/null @@ -1,41 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation -// -// See the NOTICE file(s) distributed with this work for additional -// information regarding copyright ownership. -// -// This program and the accompanying materials are made available -// under the terms of the MIT License which is available at -// https://opensource.org/licenses/MIT -// -// SPDX-License-Identifier: MIT -////////////////////////////////////////////////////////////////////////////// - -package org.eclipse.escet.tooldef.texteditor; - -import org.eclipse.escet.setext.texteditorbase.Style; -import org.eclipse.swt.SWT; - -/** Styles for the ToolDef text editor. */ -@SuppressWarnings("javadoc") -public interface ToolDefStyles { - Style DEFAULT = new Style(64, 32, 32); - - Style IDENTIFIER = new Style(0, 0, 0); - - Style COMMENT_SL = new Style(128, 128, 128, SWT.ITALIC); - - Style COMMENT_ML = new Style(128, 128, 128, SWT.ITALIC); - - Style STRING = new Style(192, 0, 0); - - Style STRING_ESCAPE = new Style(255, 128, 0); - - Style KEYWORD = new Style(0, 0, 255); - - Style BUILTIN = new Style(128, 0, 255); - - Style OPERATOR = new Style(0, 97, 192); - - Style NUMBER = new Style(0, 97, 0); -} diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditor.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditor.java index 1f22fe57f..18fa90d9d 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditor.java +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditor.java @@ -19,10 +19,11 @@ import org.eclipse.escet.tooldef.parser.ToolDefParser; import org.eclipse.escet.tooldef.typechecker.ToolDefTypeChecker; /** ToolDef text editor for Eclipse. */ -public class ToolDefTextEditor extends GenericTextEditor { +public class ToolDefTextEditor extends GenericTextEditor { /** Constructor for the {@link ToolDefTextEditor} class. */ public ToolDefTextEditor() { - super(new ToolDefPartitionScanner(), new ToolDefSourceViewerConfig(), ToolDefParser.class, + super(new ToolDefPartitionScanner(), theme -> new ToolDefSourceViewerConfig(theme), + new ToolDefTextEditorDarkTheme(), new ToolDefTextEditorLightTheme(), ToolDefParser.class, ToolDefTypeChecker.class, "org.eclipse.escet.tooldef.texteditor.ToolDefSyntaxProblem", "org.eclipse.escet.tooldef.texteditor.ToolDefSemanticProblem", "//"); } diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorDarkTheme.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorDarkTheme.java new file mode 100644 index 000000000..5aae60834 --- /dev/null +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorDarkTheme.java @@ -0,0 +1,48 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.tooldef.texteditor; + +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; +import org.eclipse.swt.SWT; + +/** ToolDef text editor dark theme. */ +public class ToolDefTextEditorDarkTheme implements TextEditorTheme { + @Override + public Style getStyle(ToolDefTextEditorStyleNames namedStyle) { + switch (namedStyle) { + case DEFAULT: + return new Style(240, 240, 240); + case IDENTIFIER: + return new Style(240, 240, 240); + case COMMENT_SL: + return new Style(160, 160, 160, SWT.ITALIC); + case COMMENT_ML: + return new Style(160, 160, 160, SWT.ITALIC); + case STRING: + return new Style(235, 64, 64); + case STRING_ESCAPE: + return new Style(235, 150, 40); + case KEYWORD: + return new Style(0, 164, 255); + case BUILTIN: + return new Style(210, 110, 255); + case OPERATOR: + return new Style(64, 210, 210); + case NUMBER: + return new Style(24, 225, 24); + } + throw new AssertionError(); + } +} diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorLightTheme.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorLightTheme.java new file mode 100644 index 000000000..ecf7a0624 --- /dev/null +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorLightTheme.java @@ -0,0 +1,48 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.tooldef.texteditor; + +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; +import org.eclipse.swt.SWT; + +/** ToolDef text editor light theme. */ +public class ToolDefTextEditorLightTheme implements TextEditorTheme { + @Override + public Style getStyle(ToolDefTextEditorStyleNames namedStyle) { + switch (namedStyle) { + case DEFAULT: + return new Style(0, 0, 0); + case IDENTIFIER: + return new Style(0, 0, 0); + case COMMENT_SL: + return new Style(128, 128, 128, SWT.ITALIC); + case COMMENT_ML: + return new Style(128, 128, 128, SWT.ITALIC); + case STRING: + return new Style(192, 0, 0); + case STRING_ESCAPE: + return new Style(255, 128, 0); + case KEYWORD: + return new Style(0, 0, 255); + case BUILTIN: + return new Style(128, 0, 255); + case OPERATOR: + return new Style(0, 97, 192); + case NUMBER: + return new Style(0, 97, 0); + } + throw new AssertionError(); + } +} diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorPreferencePage.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorPreferencePage.java new file mode 100644 index 000000000..6934fa35a --- /dev/null +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorPreferencePage.java @@ -0,0 +1,21 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.tooldef.texteditor; + +import org.eclipse.escet.setext.texteditorbase.GenericTextEditorPreferencePage; + +/** ToolDef text editor preference page. */ +public class ToolDefTextEditorPreferencePage extends GenericTextEditorPreferencePage { + // Base class provides all functionality. +} diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorScanner.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorScanner.java index 2b78dcfef..73e691c20 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorScanner.java +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorScanner.java @@ -14,6 +14,12 @@ package org.eclipse.escet.tooldef.texteditor; import static org.eclipse.escet.common.java.Strings.fmt; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.BUILTIN; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.DEFAULT; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.IDENTIFIER; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.KEYWORD; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.NUMBER; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.OPERATOR; import org.apache.commons.lang3.ArrayUtils; import org.eclipse.escet.setext.texteditorbase.ColorManager; @@ -22,6 +28,7 @@ import org.eclipse.escet.setext.texteditorbase.detectors.GenericWhitespaceDetect import org.eclipse.escet.setext.texteditorbase.rules.IntNumberRule; import org.eclipse.escet.setext.texteditorbase.rules.KeywordsRule; import org.eclipse.escet.setext.texteditorbase.rules.RegExRule; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.escet.tooldef.parser.ToolDefScanner; import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.WhitespaceRule; @@ -31,9 +38,10 @@ public class ToolDefTextEditorScanner extends RuleBasedScannerEx { /** * Constructor for the {@link ToolDefTextEditorScanner} class. * + * @param theme The theme to use. * @param manager The color manager to use to create the color tokens. */ - public ToolDefTextEditorScanner(ColorManager manager) { + public ToolDefTextEditorScanner(TextEditorTheme theme, ColorManager manager) { // Keywords copied from ToolDef scanner. String[] keywords = ToolDefScanner.getKeywords("Keyword"); String[] operators = ToolDefScanner.getKeywords("Operator"); @@ -63,16 +71,17 @@ public class ToolDefTextEditorScanner extends RuleBasedScannerEx { // Construct and set predicate rules. Make sure we also have a default // token. IRule[] rules = new IRule[] { // - new KeywordsRule(keywords, ToolDefStyles.KEYWORD.createToken(manager)), // - new KeywordsRule(builtins, ToolDefStyles.BUILTIN.createToken(manager)), // - new KeywordsRule(operators, ToolDefStyles.OPERATOR.createToken(manager)), // - new RegExRule(namePat, ToolDefStyles.IDENTIFIER.createToken(manager)), // - new RegExRule(realPat, ToolDefStyles.NUMBER.createToken(manager)), // - new IntNumberRule(ToolDefStyles.NUMBER.createToken(manager)), // - new WhitespaceRule(new GenericWhitespaceDetector()) // + new KeywordsRule(keywords, theme.getStyle(KEYWORD).createToken(manager)), + new KeywordsRule(builtins, theme.getStyle(BUILTIN).createToken(manager)), + new KeywordsRule(operators, theme.getStyle(OPERATOR).createToken(manager)), + new RegExRule(namePat, theme.getStyle(IDENTIFIER).createToken(manager)), + new RegExRule(realPat, theme.getStyle(NUMBER).createToken(manager)), + new IntNumberRule(theme.getStyle(NUMBER).createToken(manager)), + new WhitespaceRule(new GenericWhitespaceDetector()) + // }; setRules(rules); - setDefaultReturnToken(ToolDefStyles.DEFAULT.createToken(manager)); + setDefaultReturnToken(theme.getStyle(DEFAULT).createToken(manager)); } } diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorStyleNames.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorStyleNames.java new file mode 100644 index 000000000..5db5a999f --- /dev/null +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorStyleNames.java @@ -0,0 +1,47 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.tooldef.texteditor; + +/** ToolDef text editor style names. */ +public enum ToolDefTextEditorStyleNames { + /** Default style. */ + DEFAULT, + + /** Identifier style. */ + IDENTIFIER, + + /** Single-line comment style. */ + COMMENT_SL, + + /** Multi-line comment style. */ + COMMENT_ML, + + /** String literal style. */ + STRING, + + /** String literal escape sequence style. */ + STRING_ESCAPE, + + /** Keyword style. */ + KEYWORD, + + /** Built-in tool style. */ + BUILTIN, + + /** Operator style. */ + OPERATOR, + + /** Number literal style. */ + NUMBER, +} -- GitLab From 923f0eea511a51797f1a090962e0d76c596a73f7 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 4 Sep 2022 16:23:53 +0200 Subject: [PATCH 05/51] #347 Add dark/light theme support to SeText text editor. --- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 9 ++++ .../texteditor/SeTextCodeHighlighterIT.java | 20 ++++----- .../texteditor/SeTextCodeHighlighter.java | 15 ++++++- .../texteditor/SeTextSourceViewerConfig.java | 25 +++++++++-- .../setext/texteditor/SeTextTextEditor.java | 7 ++-- .../texteditor/SeTextTextEditorDarkTheme.java | 42 +++++++++++++++++++ .../SeTextTextEditorLightTheme.java | 42 +++++++++++++++++++ .../SeTextTextEditorPreferencePage.java | 21 ++++++++++ .../texteditor/SeTextTextEditorScanner.java | 21 ++++++---- ...s.java => SeTextTextEditorStyleNames.java} | 29 +++++++------ 11 files changed, 195 insertions(+), 39 deletions(-) create mode 100644 setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorDarkTheme.java create mode 100644 setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorLightTheme.java create mode 100644 setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorPreferencePage.java rename setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/{SeTextStyles.java => SeTextTextEditorStyleNames.java} (53%) diff --git a/setext/org.eclipse.escet.setext.texteditor/META-INF/MANIFEST.MF b/setext/org.eclipse.escet.setext.texteditor/META-INF/MANIFEST.MF index 0ba251853..535bf6490 100644 --- a/setext/org.eclipse.escet.setext.texteditor/META-INF/MANIFEST.MF +++ b/setext/org.eclipse.escet.setext.texteditor/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.17.0", org.eclipse.escet.setext.typechecker;bundle-version="0.7.0", org.eclipse.escet.setext.runtime;bundle-version="0.7.0", org.eclipse.escet.setext.texteditorbase;bundle-version="0.7.0", - org.junit;bundle-version="4.12.0" + org.junit;bundle-version="4.12.0", + org.eclipse.ui.ide;bundle-version="3.18.200" Export-Package: org.eclipse.escet.setext.texteditor Automatic-Module-Name: org.eclipse.escet.setext.texteditor diff --git a/setext/org.eclipse.escet.setext.texteditor/plugin.xml b/setext/org.eclipse.escet.setext.texteditor/plugin.xml index 28e7bf8d6..df3fa4113 100644 --- a/setext/org.eclipse.escet.setext.texteditor/plugin.xml +++ b/setext/org.eclipse.escet.setext.texteditor/plugin.xml @@ -39,4 +39,13 @@ + + + + + diff --git a/setext/org.eclipse.escet.setext.texteditor/src-test/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighterIT.java b/setext/org.eclipse.escet.setext.texteditor/src-test/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighterIT.java index b4f598991..9906d12f9 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src-test/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighterIT.java +++ b/setext/org.eclipse.escet.setext.texteditor/src-test/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighterIT.java @@ -35,33 +35,33 @@ public class SeTextCodeHighlighterIT { List expectedHtml = list( // "", // - "@", // + "@", // "terminals", // - ": ", // + ": ", // "/* ", // "bla ", // "*/ ", // "x ", // - "= ", // - "5; ", // + "= ", // + "5; ", // "
ARROWTK", // "       ", // - "= ", // + "= ", // ""\\->"", // - "; ", // + "; ", // "// ", // "abc ", // - "

  @", // + "

  @", // "shortcut ", // "identifier ", // - "= ", // + "= ", // ""[$]?[a-zA-Z_][a-zA-Z0-9_]*"", // - ";", // + ";", // "" // ); String actualHtml; - try (CodeHighlighter highlighter = new SeTextCodeHighlighter()) { + try (CodeHighlighter highlighter = new SeTextCodeHighlighter(new SeTextTextEditorLightTheme())) { actualHtml = highlighter.toHtml(String.join("", code)); } assertEquals(String.join("", expectedHtml), actualHtml); diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighter.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighter.java index f3e09af7d..68be5ec54 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighter.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighter.java @@ -15,13 +15,26 @@ package org.eclipse.escet.setext.texteditor; import org.eclipse.escet.setext.texteditorbase.highlight.CodeHighlighter; import org.eclipse.escet.setext.texteditorbase.scanners.GenericPartitionScanner; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.presentation.IPresentationReconciler; /** SeText code highlighter. */ public class SeTextCodeHighlighter extends CodeHighlighter { + /** The theme to use. */ + private final TextEditorTheme theme; + + /** + * Constructor for the {@link SeTextCodeHighlighter} class. + * + * @param theme The theme to use. + */ + public SeTextCodeHighlighter(TextEditorTheme theme) { + this.theme = theme; + } + @Override protected IPresentationReconciler obtainPresentationReconciler() { - SeTextSourceViewerConfig config = new SeTextSourceViewerConfig(); + SeTextSourceViewerConfig config = new SeTextSourceViewerConfig(theme); config.setColorManager(colorManager); return config.getPresentationReconciler(null); } diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextSourceViewerConfig.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextSourceViewerConfig.java index d3565b8f9..90ff88fba 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextSourceViewerConfig.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextSourceViewerConfig.java @@ -13,29 +13,46 @@ package org.eclipse.escet.setext.texteditor; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.COMMENT_ML; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.COMMENT_SL; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.STRING; + import org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration; import org.eclipse.escet.setext.texteditorbase.scanners.SingleStyleScanner; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.presentation.PresentationReconciler; import org.eclipse.jface.text.rules.ITokenScanner; /** SeText text editor source viewer configuration. */ public class SeTextSourceViewerConfig extends GenericSourceViewerConfiguration { + /** The theme to use. */ + private final TextEditorTheme theme; + + /** + * Constructor for the {@link SeTextSourceViewerConfig} class. + * + * @param theme The theme to use. + */ + public SeTextSourceViewerConfig(TextEditorTheme theme) { + this.theme = theme; + } + @Override protected void addDamagersRepairers(PresentationReconciler reconciler) { // DEFAULT. - ITokenScanner scanner = new SeTextTextEditorScanner(colorManager); + ITokenScanner scanner = new SeTextTextEditorScanner(theme, colorManager); addDamagerRepairer(reconciler, scanner, DEFAULT_CONTENT_TYPE); // COMMENT_ML. - ITokenScanner commentMlScanner = new SingleStyleScanner(SeTextStyles.COMMENT_ML.createToken(colorManager)); + ITokenScanner commentMlScanner = new SingleStyleScanner(theme.getStyle(COMMENT_ML).createToken(colorManager)); addDamagerRepairer(reconciler, commentMlScanner, "__setext_comment_ml"); // COMMENT_SL. - ITokenScanner commentSlScanner = new SingleStyleScanner(SeTextStyles.COMMENT_SL.createToken(colorManager)); + ITokenScanner commentSlScanner = new SingleStyleScanner(theme.getStyle(COMMENT_SL).createToken(colorManager)); addDamagerRepairer(reconciler, commentSlScanner, "__setext_comment_sl"); // STRING. - ITokenScanner stringScanner = new SingleStyleScanner(SeTextStyles.STRING.createToken(colorManager)); + ITokenScanner stringScanner = new SingleStyleScanner(theme.getStyle(STRING).createToken(colorManager)); addDamagerRepairer(reconciler, stringScanner, "__setext_string"); } } diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditor.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditor.java index a257dfc97..f6c285c66 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditor.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditor.java @@ -19,11 +19,12 @@ import org.eclipse.escet.setext.texteditorbase.GenericTextEditor; import org.eclipse.escet.setext.typechecker.SeTextTypeChecker; /** SeText text editor for Eclipse. */ -public class SeTextTextEditor extends GenericTextEditor { +public class SeTextTextEditor extends GenericTextEditor { /** Constructor for the {@link SeTextTextEditor} class. */ public SeTextTextEditor() { - super(new SeTextPartitionScanner(), new SeTextSourceViewerConfig(), SeTextParser.class, SeTextTypeChecker.class, - "org.eclipse.escet.setext.texteditor.SeTextSyntaxProblem", + super(new SeTextPartitionScanner(), theme -> new SeTextSourceViewerConfig(theme), + new SeTextTextEditorDarkTheme(), new SeTextTextEditorLightTheme(), SeTextParser.class, + SeTextTypeChecker.class, "org.eclipse.escet.setext.texteditor.SeTextSyntaxProblem", "org.eclipse.escet.setext.texteditor.SeTextSemanticProblem", "//"); } } diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorDarkTheme.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorDarkTheme.java new file mode 100644 index 000000000..3f14940ba --- /dev/null +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorDarkTheme.java @@ -0,0 +1,42 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.setext.texteditor; + +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; +import org.eclipse.swt.SWT; + +/** SeText text editor dark theme. */ +public class SeTextTextEditorDarkTheme implements TextEditorTheme { + @Override + public Style getStyle(SeTextTextEditorStyleNames namedStyle) { + switch (namedStyle) { + case DEFAULT: + return new Style(240, 240, 240); + case IDENTIFIER: + return new Style(240, 240, 240); + case DESCRIPTION: + return new Style(64, 210, 210); + case COMMENT_SL: + return new Style(160, 160, 160, SWT.ITALIC); + case COMMENT_ML: + return new Style(160, 160, 160, SWT.ITALIC); + case STRING: + return new Style(235, 64, 64); + case KEYWORD: + return new Style(0, 164, 255); + } + throw new AssertionError(); + } +} diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorLightTheme.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorLightTheme.java new file mode 100644 index 000000000..0c964baf3 --- /dev/null +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorLightTheme.java @@ -0,0 +1,42 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.setext.texteditor; + +import org.eclipse.escet.setext.texteditorbase.Style; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; +import org.eclipse.swt.SWT; + +/** SeText text editor light theme. */ +public class SeTextTextEditorLightTheme implements TextEditorTheme { + @Override + public Style getStyle(SeTextTextEditorStyleNames namedStyle) { + switch (namedStyle) { + case DEFAULT: + return new Style(0, 0, 0); + case IDENTIFIER: + return new Style(0, 0, 0); + case DESCRIPTION: + return new Style(0, 97, 192); + case COMMENT_SL: + return new Style(128, 128, 128, SWT.ITALIC); + case COMMENT_ML: + return new Style(128, 128, 128, SWT.ITALIC); + case STRING: + return new Style(192, 0, 0); + case KEYWORD: + return new Style(0, 0, 255); + } + throw new AssertionError(); + } +} diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorPreferencePage.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorPreferencePage.java new file mode 100644 index 000000000..085f0cefd --- /dev/null +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorPreferencePage.java @@ -0,0 +1,21 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.setext.texteditor; + +import org.eclipse.escet.setext.texteditorbase.GenericTextEditorPreferencePage; + +/** SeText text editor preference page. */ +public class SeTextTextEditorPreferencePage extends GenericTextEditorPreferencePage { + // Base class provides all functionality. +} diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorScanner.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorScanner.java index 677354c8b..8db7302ee 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorScanner.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorScanner.java @@ -14,6 +14,10 @@ package org.eclipse.escet.setext.texteditor; import static org.eclipse.escet.common.java.Strings.fmt; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.DEFAULT; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.DESCRIPTION; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.IDENTIFIER; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.KEYWORD; import org.eclipse.escet.setext.parser.SeTextScanner; import org.eclipse.escet.setext.texteditorbase.ColorManager; @@ -21,6 +25,7 @@ import org.eclipse.escet.setext.texteditorbase.RuleBasedScannerEx; import org.eclipse.escet.setext.texteditorbase.detectors.GenericWhitespaceDetector; import org.eclipse.escet.setext.texteditorbase.rules.KeywordsRule; import org.eclipse.escet.setext.texteditorbase.rules.RegExRule; +import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.WhitespaceRule; @@ -29,9 +34,10 @@ public class SeTextTextEditorScanner extends RuleBasedScannerEx { /** * Constructor for the {@link SeTextTextEditorScanner} class. * + * @param theme The theme to use. * @param manager The color manager to use to create the color tokens. */ - public SeTextTextEditorScanner(ColorManager manager) { + public SeTextTextEditorScanner(TextEditorTheme theme, ColorManager manager) { // Get keywords. String[] keywords = SeTextScanner.getKeywords("Keywords"); @@ -44,14 +50,15 @@ public class SeTextTextEditorScanner extends RuleBasedScannerEx { // Construct and set predicate rules. Make sure we also have a default // token. IRule[] rules = new IRule[] { // - new KeywordsRule(keywords, SeTextStyles.KEYWORD.createToken(manager)), // - new RegExRule(idPat, SeTextStyles.IDENTIFIER.createToken(manager)), // - new RegExRule(namePat, SeTextStyles.IDENTIFIER.createToken(manager)), // - new RegExRule(descrPat, SeTextStyles.DESCRIPTION.createToken(manager)), // - new WhitespaceRule(new GenericWhitespaceDetector()), // + new KeywordsRule(keywords, theme.getStyle(KEYWORD).createToken(manager)), + new RegExRule(idPat, theme.getStyle(IDENTIFIER).createToken(manager)), + new RegExRule(namePat, theme.getStyle(IDENTIFIER).createToken(manager)), + new RegExRule(descrPat, theme.getStyle(DESCRIPTION).createToken(manager)), + new WhitespaceRule(new GenericWhitespaceDetector()), + // }; setRules(rules); - setDefaultReturnToken(SeTextStyles.DEFAULT.createToken(manager)); + setDefaultReturnToken(theme.getStyle(DEFAULT).createToken(manager)); } } diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextStyles.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStyleNames.java similarity index 53% rename from setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextStyles.java rename to setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStyleNames.java index f4f544bfb..2ac3c1563 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextStyles.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStyleNames.java @@ -13,23 +13,26 @@ package org.eclipse.escet.setext.texteditor; -import org.eclipse.escet.setext.texteditorbase.Style; -import org.eclipse.swt.SWT; +/** SeText text editor style names. */ +public enum SeTextTextEditorStyleNames { + /** Default style. */ + DEFAULT, -/** Styles for the SeText text editor. */ -@SuppressWarnings("javadoc") -public interface SeTextStyles { - Style DEFAULT = new Style(64, 32, 32); + /** Identifier style. */ + IDENTIFIER, - Style IDENTIFIER = new Style(0, 0, 0); + /** Description style. */ + DESCRIPTION, - Style DESCRIPTION = new Style(0, 97, 192); + /** Single-line comment style. */ + COMMENT_SL, - Style COMMENT_SL = new Style(128, 128, 128, SWT.ITALIC); + /** Multi-line comment style. */ + COMMENT_ML, - Style COMMENT_ML = new Style(128, 128, 128, SWT.ITALIC); + /** String literal style. */ + STRING, - Style STRING = new Style(192, 0, 0); - - Style KEYWORD = new Style(0, 0, 255); + /** Keyword style. */ + KEYWORD, } -- GitLab From ce9a5f9c54c20a9ef179675f74f6f353a11d6a72 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 4 Sep 2022 16:27:59 +0200 Subject: [PATCH 06/51] #347 Update CIF to yEd to use CIF text editor light theme. --- .../src/org/eclipse/escet/cif/cif2yed/CifToYedDiagram.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cif/org.eclipse.escet.cif.cif2yed/src/org/eclipse/escet/cif/cif2yed/CifToYedDiagram.java b/cif/org.eclipse.escet.cif.cif2yed/src/org/eclipse/escet/cif/cif2yed/CifToYedDiagram.java index c6e92083b..f3a2c5e87 100644 --- a/cif/org.eclipse.escet.cif.cif2yed/src/org/eclipse/escet/cif/cif2yed/CifToYedDiagram.java +++ b/cif/org.eclipse.escet.cif.cif2yed/src/org/eclipse/escet/cif/cif2yed/CifToYedDiagram.java @@ -31,6 +31,7 @@ import org.eclipse.escet.cif.cif2yed.options.SyntaxHighlightingOption; import org.eclipse.escet.cif.cif2yed.options.TransparentEdgeLabelsOption; import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.cif.texteditor.CifCodeHighlighter; +import org.eclipse.escet.cif.texteditor.CifTextEditorLightTheme; import org.eclipse.escet.common.app.framework.AppEnv; import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; import org.eclipse.escet.common.java.Assert; @@ -97,7 +98,7 @@ public abstract class CifToYedDiagram { highlight = SyntaxHighlightingOption.applyHighlighting(); if (highlight) { AppEnv.checkGuiAvailable("apply syntax highlighting in the CIF to yEd transformer"); - highlighter = new CifCodeHighlighter(); + highlighter = new CifCodeHighlighter(new CifTextEditorLightTheme()); } Assert.ifAndOnlyIf(highlight, highlighter != null); -- GitLab From 2af3a716776ba39a799d0626f1fb48221321f9c6 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 4 Sep 2022 16:36:08 +0200 Subject: [PATCH 07/51] #347 Dark theme color tweak. --- .../eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java | 2 +- .../eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java | 4 ++-- .../escet/setext/texteditor/SeTextTextEditorDarkTheme.java | 4 ++-- .../escet/tooldef/texteditor/ToolDefTextEditorDarkTheme.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java index 942447783..ceec977c3 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java @@ -27,7 +27,7 @@ public class ChiTextEditorDarkTheme implements TextEditorTheme Date: Sun, 4 Sep 2022 17:09:52 +0200 Subject: [PATCH 08/51] #347 Update CIF to yEd tests for CIF 'DEFAULT' color change. --- .../tests/cif2yed/all_colors.model.graphml | 14 +-- .../cif2yed/all_colors.relations.graphml | 20 ++-- .../tests/cif2yed/comm_auts.model.graphml | 6 +- .../tests/cif2yed/comm_auts.relations.graphml | 6 +- .../tests/cif2yed/comm_def_inst.model.graphml | 20 ++-- .../cif2yed/comm_def_inst.relations.graphml | 38 +++--- .../tests/cif2yed/comm_sync.model.graphml | 6 +- .../tests/cif2yed/comm_sync.relations.graphml | 6 +- .../tests/cif2yed/comp_param.model.graphml | 18 +-- .../tests/cif2yed/data_all.model.graphml | 10 +- .../tests/cif2yed/data_basic.model.graphml | 14 +-- .../cif2yed/data_basic.relations.graphml | 12 +- .../tests/cif2yed/data_refs.model.graphml | 36 +++--- .../tests/cif2yed/data_refs.relations.graphml | 24 ++-- .../tests/cif2yed/empty_comps.model.graphml | 28 ++--- .../cif2yed/empty_comps.relations.graphml | 16 +-- .../tests/cif2yed/evt_local_use.model.graphml | 14 +-- .../cif2yed/evt_local_use.relations.graphml | 18 +-- .../evt_param_directions.model.graphml | 46 +++---- .../evt_param_directions.relations.graphml | 112 +++++++++--------- .../tests/cif2yed/evt_params.model.graphml | 14 +-- .../cif2yed/evt_params.relations.graphml | 16 +-- .../cif2yed/evt_ref_complex.model.graphml | 20 ++-- .../cif2yed/evt_ref_complex.relations.graphml | 36 +++--- .../tests/cif2yed/evt_ref_cross.model.graphml | 14 +-- .../cif2yed/evt_ref_cross.relations.graphml | 16 +-- .../cif2yed/evt_ref_def_in_def.model.graphml | 20 ++-- .../evt_ref_def_in_def.relations.graphml | 28 ++--- .../evt_ref_passed_along.model.graphml | 20 ++-- .../evt_ref_passed_along.relations.graphml | 28 ++--- .../cif2yed/evt_ref_via_inst.model.graphml | 14 +-- .../evt_ref_via_inst.relations.graphml | 12 +- .../tests/cif2yed/inits.model.graphml | 6 +- .../tests/cif2yed/insts.model.graphml | 10 +- .../tests/cif2yed/locs_edges.model.graphml | 12 +- .../cif2yed/locs_edges.relations.graphml | 8 +- .../cif2yed/model_filter_all.model.graphml | 14 +-- .../model_filter_default.model.graphml | 14 +-- .../tests/cif2yed/rel_cont_der.model.graphml | 2 +- .../tests/cif2yed/small.model.graphml | 4 +- 40 files changed, 386 insertions(+), 386 deletions(-) diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/all_colors.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/all_colors.model.graphml index 8a6359698..5a3107299 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/all_colors.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/all_colors.model.graphml @@ -56,7 +56,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">evt1</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">evt1;</span></html> @@ -207,14 +207,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Grp2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Grp2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Grp2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Grp2()</span></html> @@ -229,14 +229,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">param2</span><span style="color:#402020;">;</span>&nbsp;<span style="color:#0000ff;">location</span>&nbsp;<span style="color:#000000;">param3</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Aut2(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">param2;</span>&nbsp;<span style="color:#0000ff;">location</span>&nbsp;<span style="color:#000000;">param3)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">param2</span><span style="color:#402020;">;</span>&nbsp;<span style="color:#0000ff;">location</span>&nbsp;<span style="color:#000000;">param3</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Aut2(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">param2;</span>&nbsp;<span style="color:#0000ff;">location</span>&nbsp;<span style="color:#000000;">param3)</span></html> @@ -356,7 +356,7 @@ Instantiations - <html><span style="color:#000000;">aut2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">(</span><span style="color:#000000;">grp1.aut1.evt1</span><span style="color:#402020;">,</span>&nbsp;<span style="color:#000000;">grp1.aut1.loc</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">aut2:</span>&nbsp;<span style="color:#000000;">Aut2(grp1.aut1.evt1,</span>&nbsp;<span style="color:#000000;">grp1.aut1.loc);</span></html> @@ -383,7 +383,7 @@ Instantiations - <html><span style="color:#000000;">grp2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Grp2</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">grp2:</span>&nbsp;<span style="color:#000000;">Grp2();</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/all_colors.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/all_colors.relations.graphml index ff3c6d412..a9c01005b 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/all_colors.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/all_colors.relations.graphml @@ -114,14 +114,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Grp2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Grp2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Grp2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Grp2()</span></html> @@ -138,14 +138,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Aut2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Aut2()</span></html> @@ -231,14 +231,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">aut2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">aut2:</span>&nbsp;<span style="color:#000000;">Aut2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">aut2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">aut2:</span>&nbsp;<span style="color:#000000;">Aut2()</span></html> @@ -362,14 +362,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">grp2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Grp2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">grp2:</span>&nbsp;<span style="color:#000000;">Grp2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">grp2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Grp2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">grp2:</span>&nbsp;<span style="color:#000000;">Grp2()</span></html> @@ -419,14 +419,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">aut2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">aut2:</span>&nbsp;<span style="color:#000000;">Aut2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">aut2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Aut2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">aut2:</span>&nbsp;<span style="color:#000000;">Aut2()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_auts.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_auts.model.graphml index 7b66eb52f..1331aa7db 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_auts.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_auts.model.graphml @@ -60,7 +60,7 @@ - <html><span style="color:#000000;">e</span><span style="color:#402020;">!</span><span style="color:#006100;">5</span></html> + <html><span style="color:#000000;">e!</span><span style="color:#006100;">5</span></html> @@ -122,7 +122,7 @@ - <html><span style="color:#000000;">e</span><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">e?</span></html> @@ -198,7 +198,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">e;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_auts.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_auts.relations.graphml index 3bdd6ab9a..904f62181 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_auts.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_auts.relations.graphml @@ -33,7 +33,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -102,7 +102,7 @@ - <html><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">?</span></html> @@ -137,7 +137,7 @@ - <html><span style="color:#402020;">!</span></html> + <html><span style="color:#000000;">!</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_def_inst.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_def_inst.model.graphml index 6c6bdb04c..b2ed04aff 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_def_inst.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_def_inst.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Send</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">s</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Send(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">s)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Send</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">s</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Send(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">s)</span></html> @@ -60,7 +60,7 @@ - <html><span style="color:#000000;">s</span><span style="color:#402020;">!</span><span style="color:#006100;">5</span></html> + <html><span style="color:#000000;">s!</span><span style="color:#006100;">5</span></html> @@ -72,14 +72,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Recv</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Recv(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">r)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Recv</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Recv(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">r)</span></html> @@ -122,7 +122,7 @@ - <html><span style="color:#000000;">r</span><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">r?</span></html> @@ -134,14 +134,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Sync</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Sync(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">c)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Sync</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Sync(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">c)</span></html> @@ -198,7 +198,7 @@ Instantiations - <html><span style="color:#000000;">send</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Send</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">recv</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Recv</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">sync</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Sync</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">send:</span>&nbsp;<span style="color:#000000;">Send(e);</span><br><span style="color:#000000;">recv:</span>&nbsp;<span style="color:#000000;">Recv(e);</span><br><span style="color:#000000;">sync:</span>&nbsp;<span style="color:#000000;">Sync(e);</span></html> @@ -223,7 +223,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">e;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_def_inst.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_def_inst.relations.graphml index a7d492388..727c22d87 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_def_inst.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_def_inst.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Send</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Send()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Send</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Send()</span></html> @@ -33,7 +33,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">s</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">s</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -45,7 +45,7 @@ - <html><span style="color:#402020;">!</span></html> + <html><span style="color:#000000;">!</span></html> @@ -59,14 +59,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Recv</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Recv()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Recv</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Recv()</span></html> @@ -80,7 +80,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">r</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">r</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -92,7 +92,7 @@ - <html><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">?</span></html> @@ -106,14 +106,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Sync</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Sync()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Sync</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">Sync()</span></html> @@ -177,14 +177,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">send</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Send</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">send:</span>&nbsp;<span style="color:#000000;">Send()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">send</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Send</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">send:</span>&nbsp;<span style="color:#000000;">Send()</span></html> @@ -198,7 +198,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">s</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">s</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -213,14 +213,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">recv</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Recv</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">recv:</span>&nbsp;<span style="color:#000000;">Recv()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">recv</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Recv</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">recv:</span>&nbsp;<span style="color:#000000;">Recv()</span></html> @@ -234,7 +234,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">r</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">r</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -249,14 +249,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sync</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Sync</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sync:</span>&nbsp;<span style="color:#000000;">Sync()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sync</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">Sync</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sync:</span>&nbsp;<span style="color:#000000;">Sync()</span></html> @@ -284,7 +284,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span>&nbsp;<span style="color:#000000;">!?~</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_sync.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_sync.model.graphml index 093f1029d..464859238 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_sync.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_sync.model.graphml @@ -69,7 +69,7 @@ - <html><span style="color:#000000;">h</span><span style="color:#402020;">!</span><span style="color:#006100;">5</span></html> + <html><span style="color:#000000;">h!</span><span style="color:#006100;">5</span></html> @@ -140,7 +140,7 @@ - <html><span style="color:#000000;">h</span><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">h?</span></html> @@ -225,7 +225,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">h</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">h;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_sync.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_sync.relations.graphml index 16078b309..ad203bd22 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_sync.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comm_sync.relations.graphml @@ -57,7 +57,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">h</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">h</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -149,7 +149,7 @@ - <html><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">?</span></html> @@ -195,7 +195,7 @@ - <html><span style="color:#402020;">!</span></html> + <html><span style="color:#000000;">!</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comp_param.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comp_param.model.graphml index 33a87ae0c..bc470baac 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comp_param.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/comp_param.model.graphml @@ -32,14 +32,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G7</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G7()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G7</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G7()</span></html> @@ -100,7 +100,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e10</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e10;</span></html> @@ -184,14 +184,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G2</span><span style="color:#402020;">(</span><span style="color:#000000;">g6.G7</span>&nbsp;<span style="color:#000000;">p3</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G2(g6.G7</span>&nbsp;<span style="color:#000000;">p3)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G2</span><span style="color:#402020;">(</span><span style="color:#000000;">g6.G7</span>&nbsp;<span style="color:#000000;">p3</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G2(g6.G7</span>&nbsp;<span style="color:#000000;">p3)</span></html> @@ -228,14 +228,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A5</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A5()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A5</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A5()</span></html> @@ -292,7 +292,7 @@ Instantiations - <html><span style="color:#000000;">a5</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A5</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">a5:</span>&nbsp;<span style="color:#000000;">A5();</span></html> @@ -323,7 +323,7 @@ Instantiations - <html><span style="color:#000000;">g2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">g1.G2</span><span style="color:#402020;">(</span><span style="color:#000000;">g7</span><span style="color:#402020;">);</span><br><span style="color:#000000;">g7</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">g6.G7</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">g2:</span>&nbsp;<span style="color:#000000;">g1.G2(g7);</span><br><span style="color:#000000;">g7:</span>&nbsp;<span style="color:#000000;">g6.G7();</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_all.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_all.model.graphml index 2a470266e..3a16df5d5 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_all.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_all.model.graphml @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">real</span>&nbsp;<span style="color:#000000;">v</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">z</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">real</span>&nbsp;<span style="color:#000000;">v</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">z;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -87,7 +87,7 @@ - <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">v</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">0</span></html> + <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">v</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">0</span></html> @@ -149,7 +149,7 @@ - <html><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">a.v</span>&nbsp;<span style="color:#402020;">&lt;=</span>&nbsp;<span style="color:#006100;">0</span></html> + <html><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">a.v</span>&nbsp;<span style="color:#000000;">&lt;=</span>&nbsp;<span style="color:#006100;">0</span></html> @@ -169,7 +169,7 @@ - <html><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">a.v</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">0</span></html> + <html><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">a.v</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">0</span></html> @@ -183,7 +183,7 @@ Declarations - <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">real</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#0000ff;">if</span>&nbsp;<span style="color:#000000;">b.l1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#006100;">1.0</span>&nbsp;<span style="color:#0000ff;">elif</span>&nbsp;<span style="color:#000000;">b.l2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#006100;">2.0</span>&nbsp;<span style="color:#0000ff;">else</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#006100;">3.0</span>&nbsp;<span style="color:#0000ff;">end</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">input</span>&nbsp;<span style="color:#0000ff;">real</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">z</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">real</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#0000ff;">if</span>&nbsp;<span style="color:#000000;">b.l1:</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#006100;">1.0</span>&nbsp;<span style="color:#0000ff;">elif</span>&nbsp;<span style="color:#000000;">b.l2:</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#006100;">2.0</span>&nbsp;<span style="color:#0000ff;">else</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#006100;">3.0</span>&nbsp;<span style="color:#0000ff;">end</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">input</span>&nbsp;<span style="color:#0000ff;">real</span>&nbsp;<span style="color:#000000;">y;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">z</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">y;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_basic.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_basic.model.graphml index 4bf83f7a3..537ccb18e 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_basic.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_basic.model.graphml @@ -32,14 +32,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">location</span>&nbsp;<span style="color:#000000;">loc</span><span style="color:#402020;">;</span>&nbsp;<span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">location</span>&nbsp;<span style="color:#000000;">loc;</span>&nbsp;<span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">location</span>&nbsp;<span style="color:#000000;">loc</span><span style="color:#402020;">;</span>&nbsp;<span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">location</span>&nbsp;<span style="color:#000000;">loc;</span>&nbsp;<span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p)</span></html> @@ -56,7 +56,7 @@ Declarations - <html><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">0</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">0</span><span style="color:#000000;">;</span></html> @@ -109,7 +109,7 @@ - <html><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">1</span></html> + <html><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">1</span></html> @@ -143,7 +143,7 @@ Instantiations - <html><span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a2.l1</span><span style="color:#402020;">,</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">);</span><br><span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a1.l2</span><span style="color:#402020;">,</span>&nbsp;<span style="color:#000000;">x</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A(a2.l1,</span>&nbsp;<span style="color:#000000;">y);</span><br><span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A(a1.l2,</span>&nbsp;<span style="color:#000000;">x);</span></html> @@ -168,7 +168,7 @@ Declarations - <html><span style="color:#0000ff;">input</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">input</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">y;</span></html> @@ -197,7 +197,7 @@ Declarations - <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">g.y</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">g.y;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_basic.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_basic.relations.graphml index 1eefaf7db..a2ac4ce4e 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_basic.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_basic.relations.graphml @@ -110,14 +110,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -216,14 +216,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -276,14 +276,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_refs.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_refs.model.graphml index 9f55574ce..3a4a0a303 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_refs.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_refs.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p)</span></html> @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">v</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">v</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">v;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">v</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">p;</span></html> @@ -87,7 +87,7 @@ - <html><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">v</span>&nbsp;<span style="color:#402020;">:=</span>&nbsp;<span style="color:#000000;">p</span></html> + <html><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">v</span>&nbsp;<span style="color:#000000;">:=</span>&nbsp;<span style="color:#000000;">p</span></html> @@ -99,14 +99,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p)</span></html> @@ -123,7 +123,7 @@ Declarations - <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">pp</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">*</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">0</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">pp</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">*</span>&nbsp;<span style="color:#000000;">p;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">0</span><span style="color:#000000;">;</span></html> @@ -174,7 +174,7 @@ Declarations - <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c3</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c3;</span></html> @@ -198,7 +198,7 @@ - <html><span style="color:#000000;">l1</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c3</span><span style="color:#402020;">'</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">;</span></html> + <html><span style="color:#000000;">l1</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c3'</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">r;</span></html> @@ -236,7 +236,7 @@ - <html><span style="color:#000000;">l2</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c3</span><span style="color:#402020;">'</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">;</span></html> + <html><span style="color:#000000;">l2</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c3'</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">r;</span></html> @@ -274,7 +274,7 @@ Declarations - <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c4</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c4;</span></html> @@ -298,7 +298,7 @@ - <html><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c4</span><span style="color:#402020;">'</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c4'</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">r;</span></html> @@ -354,7 +354,7 @@ Declarations - <html><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">z</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#000000;">z</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">z</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">y;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#000000;">z;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#000000;">;</span></html> @@ -378,7 +378,7 @@ - <html><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">0</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">0</span><span style="color:#000000;">;</span></html> @@ -434,7 +434,7 @@ Declarations - <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">bool</span>&nbsp;<span style="color:#000000;">b1</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">l1</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">bool</span>&nbsp;<span style="color:#000000;">b1</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">l1;</span></html> @@ -458,7 +458,7 @@ - <html><span style="color:#000000;">l1</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">b1</span><span style="color:#402020;">;</span></html> + <html><span style="color:#000000;">l1</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">b1;</span></html> @@ -501,7 +501,7 @@ Instantiations - <html><span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a2.v</span><span style="color:#402020;">);</span><br><span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a2.v</span><span style="color:#402020;">);</span><br><span style="color:#000000;">g1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">(</span><span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">);</span><br><span style="color:#000000;">g2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">(</span><span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">*</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">*</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A(a2.v);</span><br><span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A(a2.v);</span><br><span style="color:#000000;">g1:</span>&nbsp;<span style="color:#000000;">G(x</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#000000;">y);</span><br><span style="color:#000000;">g2:</span>&nbsp;<span style="color:#000000;">G(x</span>&nbsp;<span style="color:#000000;">*</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">*</span>&nbsp;<span style="color:#000000;">y);</span></html> @@ -526,7 +526,7 @@ Declarations - <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">9</span><span style="color:#402020;">..</span><span style="color:#006100;">9</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">3</span><span style="color:#402020;">..</span><span style="color:#006100;">3</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">3</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">func</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">f</span><span style="color:#402020;">(</span><span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">a</span><span style="color:#402020;">;</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">):</span><br>&nbsp;&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">a</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">;</span><br>&nbsp;&nbsp;<span style="color:#0000ff;">return</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">end</span><br><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">z</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">f</span><span style="color:#402020;">(</span><span style="color:#000000;">x</span><span style="color:#402020;">,</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">);</span><br><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">real</span>&nbsp;<span style="color:#000000;">r</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5.0</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c1</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c2</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c5</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">c6</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c6</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">c5</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#006100;">1.0</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c7</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">c7</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c2</span><span style="color:#402020;">'</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">9</span><span style="color:#000000;">..</span><span style="color:#006100;">9</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#000000;">y;</span><br><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">3</span><span style="color:#000000;">..</span><span style="color:#006100;">3</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">3</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">func</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">f(</span><span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">a;</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">b):</span><br>&nbsp;&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">a</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#000000;">b;</span><br>&nbsp;&nbsp;<span style="color:#0000ff;">return</span>&nbsp;<span style="color:#000000;">c;</span><br><span style="color:#0000ff;">end</span><br><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">z</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">f(x,</span>&nbsp;<span style="color:#000000;">y);</span><br><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">real</span>&nbsp;<span style="color:#000000;">r</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5.0</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c1</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">r;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c2;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c5</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">c6;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c6</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">c5</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#006100;">1.0</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c7</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">c7;</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c2'</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">r;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_refs.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_refs.relations.graphml index 2a2c2c1f4..9f4ceba29 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_refs.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/data_refs.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -80,14 +80,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G()</span></html> @@ -162,14 +162,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -198,14 +198,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -330,14 +330,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">g1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">g1:</span>&nbsp;<span style="color:#000000;">G()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">g1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">g1:</span>&nbsp;<span style="color:#000000;">G()</span></html> @@ -366,14 +366,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">g2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">g2:</span>&nbsp;<span style="color:#000000;">G()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">g2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">g2:</span>&nbsp;<span style="color:#000000;">G()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/empty_comps.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/empty_comps.model.graphml index d86134a0e..8c0bbc496 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/empty_comps.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/empty_comps.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -63,14 +63,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">y)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#0000ff;">alg</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">y)</span></html> @@ -109,7 +109,7 @@ Declarations - <html><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">5</span><span style="color:#402020;">..</span><span style="color:#006100;">5</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">5</span><span style="color:#000000;">..</span><span style="color:#006100;">5</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#000000;">;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#000000;">y;</span></html> @@ -138,14 +138,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">D(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">D(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e)</span></html> @@ -184,7 +184,7 @@ Declarations - <html><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">5</span><span style="color:#402020;">..</span><span style="color:#006100;">5</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">5</span><span style="color:#000000;">..</span><span style="color:#006100;">5</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#000000;">;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#000000;">;</span></html> @@ -298,14 +298,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">E</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">E()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">E</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">E()</span></html> @@ -561,7 +561,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -719,7 +719,7 @@ Declarations - <html><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">5</span><span style="color:#402020;">..</span><span style="color:#006100;">5</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">5</span><span style="color:#000000;">..</span><span style="color:#006100;">5</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#000000;">;</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5</span><span style="color:#000000;">;</span></html> @@ -752,7 +752,7 @@ Instantiations - <html><span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">();</span><br><span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#006100;">5</span><span style="color:#402020;">);</span><br><span style="color:#000000;">d1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">(</span><span style="color:#000000;">g6.g7.e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">d2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">(</span><span style="color:#000000;">ee</span><span style="color:#402020;">);</span><br><span style="color:#000000;">e</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">E</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B();</span><br><span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#006100;">5</span><span style="color:#000000;">);</span><br><span style="color:#000000;">d1:</span>&nbsp;<span style="color:#000000;">D(g6.g7.e);</span><br><span style="color:#000000;">d2:</span>&nbsp;<span style="color:#000000;">D(ee);</span><br><span style="color:#000000;">e:</span>&nbsp;<span style="color:#000000;">E();</span></html> @@ -777,7 +777,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ee</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ee;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/empty_comps.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/empty_comps.relations.graphml index 4766fb3d6..a9ad6c449 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/empty_comps.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/empty_comps.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -82,14 +82,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">D()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">D()</span></html> @@ -296,14 +296,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">d1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">d1:</span>&nbsp;<span style="color:#000000;">D()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">d1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">d1:</span>&nbsp;<span style="color:#000000;">D()</span></html> @@ -332,14 +332,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">d2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">d2:</span>&nbsp;<span style="color:#000000;">D()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">d2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">D</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">d2:</span>&nbsp;<span style="color:#000000;">D()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_local_use.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_local_use.model.graphml index 465089060..6e4860536 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_local_use.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_local_use.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e2</span><span style="color:#402020;">;</span>&nbsp;<span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">h2</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e2;</span>&nbsp;<span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">h2)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e2</span><span style="color:#402020;">;</span>&nbsp;<span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">h2</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e2;</span>&nbsp;<span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">h2)</span></html> @@ -69,7 +69,7 @@ - <html><span style="color:#000000;">h2</span><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">h2?</span></html> @@ -105,7 +105,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -167,7 +167,7 @@ - <html><span style="color:#000000;">h</span><span style="color:#402020;">!</span><span style="color:#006100;">5</span></html> + <html><span style="color:#000000;">h!</span><span style="color:#006100;">5</span></html> @@ -252,7 +252,7 @@ Instantiations - <html><span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#000000;">a.e</span><span style="color:#402020;">,</span>&nbsp;<span style="color:#000000;">h</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B(a.e,</span>&nbsp;<span style="color:#000000;">h);</span></html> @@ -277,7 +277,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">h</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">h;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_local_use.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_local_use.relations.graphml index cadcdc28e..bd3a57da3 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_local_use.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_local_use.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -45,7 +45,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">h2</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">h2</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -57,7 +57,7 @@ - <html><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">?</span></html> @@ -127,7 +127,7 @@ - <html><span style="color:#402020;">!</span></html> + <html><span style="color:#000000;">!</span></html> @@ -164,14 +164,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -197,7 +197,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">h2</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">h2</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -257,7 +257,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">h</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">h</span>&nbsp;<span style="color:#000000;">!?~</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_param_directions.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_param_directions.model.graphml index 9c552923d..4c8e82582 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_param_directions.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_param_directions.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">X</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">X(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">X</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">X(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p)</span></html> @@ -72,14 +72,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">N</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">N(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">N</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">N(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p)</span></html> @@ -134,14 +134,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">S</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">!)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">S(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p!)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">S</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">!)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">S(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p!)</span></html> @@ -184,7 +184,7 @@ - <html><span style="color:#000000;">p</span><span style="color:#402020;">!</span><span style="color:#006100;">1</span></html> + <html><span style="color:#000000;">p!</span><span style="color:#006100;">1</span></html> @@ -196,14 +196,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">R</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">?)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">R(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p?)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">R</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">?)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">R(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p?)</span></html> @@ -246,7 +246,7 @@ - <html><span style="color:#000000;">p</span><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">p?</span></html> @@ -258,14 +258,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">~)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p~)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">~)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p~)</span></html> @@ -320,14 +320,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SR</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">!?)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SR(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p!?)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SR</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">!?)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SR(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p!?)</span></html> @@ -370,7 +370,7 @@ - <html><span style="color:#000000;">p</span><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">p?</span></html> @@ -382,14 +382,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SC</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">!~)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SC(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p!~)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SC</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">!~)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SC(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p!~)</span></html> @@ -444,14 +444,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">RC</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">?~)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">RC(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p?~)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">RC</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">?~)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">RC(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p?~)</span></html> @@ -506,14 +506,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SRC</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">!?~)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SRC(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p!?~)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SRC</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p</span><span style="color:#402020;">!?~)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SRC(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">p!?~)</span></html> @@ -570,7 +570,7 @@ Instantiations - <html><span style="color:#000000;">x</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">X</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">n</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">N</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">s</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">S</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">r</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">R</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">sr</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SR</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">sc</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SC</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">rc</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">RC</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">src</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SRC</span><span style="color:#402020;">(</span><span style="color:#000000;">e</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">x:</span>&nbsp;<span style="color:#000000;">X(e);</span><br><span style="color:#000000;">n:</span>&nbsp;<span style="color:#000000;">N(e);</span><br><span style="color:#000000;">s:</span>&nbsp;<span style="color:#000000;">S(e);</span><br><span style="color:#000000;">r:</span>&nbsp;<span style="color:#000000;">R(e);</span><br><span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C(e);</span><br><span style="color:#000000;">sr:</span>&nbsp;<span style="color:#000000;">SR(e);</span><br><span style="color:#000000;">sc:</span>&nbsp;<span style="color:#000000;">SC(e);</span><br><span style="color:#000000;">rc:</span>&nbsp;<span style="color:#000000;">RC(e);</span><br><span style="color:#000000;">src:</span>&nbsp;<span style="color:#000000;">SRC(e);</span></html> @@ -595,7 +595,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">e;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_param_directions.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_param_directions.relations.graphml index 9e66812ec..6d57f2ad3 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_param_directions.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_param_directions.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">X</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">X()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">X</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">X()</span></html> @@ -59,14 +59,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">N</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">N()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">N</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">N()</span></html> @@ -80,7 +80,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -106,14 +106,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">S</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">S()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">S</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">S()</span></html> @@ -127,7 +127,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!</span></html> @@ -139,7 +139,7 @@ - <html><span style="color:#402020;">!</span></html> + <html><span style="color:#000000;">!</span></html> @@ -153,14 +153,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">R</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">R()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">R</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">R()</span></html> @@ -174,7 +174,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">?</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">?</span></html> @@ -186,7 +186,7 @@ - <html><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">?</span></html> @@ -200,14 +200,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -221,7 +221,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">~</span></html> @@ -247,14 +247,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SR</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SR()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SR</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SR()</span></html> @@ -268,7 +268,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!?</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!?</span></html> @@ -280,7 +280,7 @@ - <html><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">?</span></html> @@ -294,14 +294,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SC()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SC()</span></html> @@ -315,7 +315,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!~</span></html> @@ -341,14 +341,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">RC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">RC()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">RC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">RC()</span></html> @@ -362,7 +362,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">?~</span></html> @@ -388,14 +388,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SRC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SRC()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SRC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">SRC()</span></html> @@ -409,7 +409,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -459,14 +459,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">x</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">X</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">x:</span>&nbsp;<span style="color:#000000;">X()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">x</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">X</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">x:</span>&nbsp;<span style="color:#000000;">X()</span></html> @@ -495,14 +495,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">n</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">N</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">n:</span>&nbsp;<span style="color:#000000;">N()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">n</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">N</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">n:</span>&nbsp;<span style="color:#000000;">N()</span></html> @@ -516,7 +516,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -531,14 +531,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">s</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">S</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">s:</span>&nbsp;<span style="color:#000000;">S()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">s</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">S</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">s:</span>&nbsp;<span style="color:#000000;">S()</span></html> @@ -552,7 +552,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!</span></html> @@ -567,14 +567,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">R</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">r:</span>&nbsp;<span style="color:#000000;">R()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">r</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">R</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">r:</span>&nbsp;<span style="color:#000000;">R()</span></html> @@ -588,7 +588,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">?</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">?</span></html> @@ -603,14 +603,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -624,7 +624,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">~</span></html> @@ -639,14 +639,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sr</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SR</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sr:</span>&nbsp;<span style="color:#000000;">SR()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sr</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SR</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sr:</span>&nbsp;<span style="color:#000000;">SR()</span></html> @@ -660,7 +660,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!?</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!?</span></html> @@ -675,14 +675,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sc</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sc:</span>&nbsp;<span style="color:#000000;">SC()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sc</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">sc:</span>&nbsp;<span style="color:#000000;">SC()</span></html> @@ -696,7 +696,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!~</span></html> @@ -711,14 +711,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">rc</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">RC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">rc:</span>&nbsp;<span style="color:#000000;">RC()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">rc</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">RC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">rc:</span>&nbsp;<span style="color:#000000;">RC()</span></html> @@ -732,7 +732,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">?~</span></html> @@ -747,14 +747,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">src</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SRC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">src:</span>&nbsp;<span style="color:#000000;">SRC()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">src</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">SRC</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">src:</span>&nbsp;<span style="color:#000000;">SRC()</span></html> @@ -768,7 +768,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">p</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -782,7 +782,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span>&nbsp;<span style="color:#000000;">!?~</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_params.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_params.model.graphml index d11db44e2..15977dd24 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_params.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_params.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e)</span></html> @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea;</span></html> @@ -99,14 +99,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e)</span></html> @@ -123,7 +123,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb;</span></html> @@ -190,7 +190,7 @@ Instantiations - <html><span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a1.ea</span><span style="color:#402020;">);</span><br><span style="color:#000000;">b1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#000000;">b1.eb</span><span style="color:#402020;">);</span><br><span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">b2.eb</span><span style="color:#402020;">);</span><br><span style="color:#000000;">b2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#000000;">a2.ea</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A(a1.ea);</span><br><span style="color:#000000;">b1:</span>&nbsp;<span style="color:#000000;">B(b1.eb);</span><br><span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A(b2.eb);</span><br><span style="color:#000000;">b2:</span>&nbsp;<span style="color:#000000;">B(a2.ea);</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_params.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_params.relations.graphml index c33223dc8..9ba00648f 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_params.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_params.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -71,14 +71,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -154,14 +154,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -202,14 +202,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b2:</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b2:</span>&nbsp;<span style="color:#000000;">B()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_complex.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_complex.model.graphml index 8e8a4b189..fd7de6bc3 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_complex.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_complex.model.graphml @@ -32,14 +32,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -56,7 +56,7 @@ Instantiations - <html><span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gB.B</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">gB.B();</span></html> @@ -105,14 +105,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -129,7 +129,7 @@ Instantiations - <html><span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gC.C</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">gC.C();</span></html> @@ -178,14 +178,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -202,7 +202,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -293,7 +293,7 @@ Instantiations - <html><span style="color:#000000;">a</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gA.A</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">a:</span>&nbsp;<span style="color:#000000;">gA.A();</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_complex.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_complex.relations.graphml index cd8455a77..1af686672 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_complex.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_complex.relations.graphml @@ -56,14 +56,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gA.A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a:</span>&nbsp;<span style="color:#000000;">gA.A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gA.A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a:</span>&nbsp;<span style="color:#000000;">gA.A()</span></html> @@ -78,14 +78,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gB.B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">gB.B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gB.B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">gB.B()</span></html> @@ -100,14 +100,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gC.C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">gC.C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gC.C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">gC.C()</span></html> @@ -164,14 +164,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -235,14 +235,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -257,14 +257,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gC.C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">gC.C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gC.C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">gC.C()</span></html> @@ -318,14 +318,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -340,14 +340,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gB.B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">gB.B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gB.B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">gB.B()</span></html> @@ -362,14 +362,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gC.C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">gC.C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">gC.C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">gC.C()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_cross.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_cross.model.graphml index e7376a530..fdb1a8a17 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_cross.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_cross.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A1</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A1()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A1</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A1()</span></html> @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e1</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e1;</span></html> @@ -99,14 +99,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A2()</span></html> @@ -123,7 +123,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e2</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e2;</span></html> @@ -190,7 +190,7 @@ Instantiations - <html><span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A1</span><span style="color:#402020;">();</span><br><span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A2</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A1();</span><br><span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A2();</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_cross.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_cross.relations.graphml index e420241b2..2ef0dbd60 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_cross.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_cross.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A1</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A1()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A1</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A1()</span></html> @@ -59,14 +59,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A2()</span></html> @@ -130,14 +130,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A1</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A1()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A1</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A1()</span></html> @@ -177,14 +177,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A2()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A2</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A2()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_def_in_def.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_def_in_def.model.graphml index 5f6063136..d5b44792e 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_def_in_def.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_def_in_def.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea)</span></html> @@ -32,14 +32,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb)</span></html> @@ -54,14 +54,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ec</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ec)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ec</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ec)</span></html> @@ -118,7 +118,7 @@ Instantiations - <html><span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#000000;">eb</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C(eb);</span></html> @@ -145,7 +145,7 @@ Instantiations - <html><span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#000000;">ea</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B(ea);</span></html> @@ -170,7 +170,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -199,7 +199,7 @@ Instantiations - <html><span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a2.e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a1.e</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A(a2.e);</span><br><span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A(a1.e);</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_def_in_def.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_def_in_def.relations.graphml index 8a5e18c29..7114a979b 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_def_in_def.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_def_in_def.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -48,14 +48,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -84,14 +84,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -155,14 +155,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -239,14 +239,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -335,14 +335,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -383,14 +383,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_passed_along.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_passed_along.model.graphml index ef4b4ebf6..d708e7710 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_passed_along.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_passed_along.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ea)</span></html> @@ -34,7 +34,7 @@ Instantiations - <html><span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#000000;">ea</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B(ea);</span></html> @@ -59,7 +59,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -86,14 +86,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">eb)</span></html> @@ -110,7 +110,7 @@ Instantiations - <html><span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#000000;">eb</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C(eb);</span></html> @@ -135,14 +135,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ec</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ec)</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ec</span><span style="color:#402020;">)</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C(</span><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">ec)</span></html> @@ -199,7 +199,7 @@ Instantiations - <html><span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a2.e</span><span style="color:#402020;">);</span><br><span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">(</span><span style="color:#000000;">a1.e</span><span style="color:#402020;">);</span></html> + <html><span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A(a2.e);</span><br><span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A(a1.e);</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_passed_along.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_passed_along.relations.graphml index cb8032cb5..317e843c8 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_passed_along.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_passed_along.relations.graphml @@ -12,14 +12,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -58,14 +58,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">b:</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -96,14 +96,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -130,14 +130,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">c:</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -168,14 +168,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">C()</span></html> @@ -239,14 +239,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -287,14 +287,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_via_inst.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_via_inst.model.graphml index c442be6f2..025e5d1de 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_via_inst.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_via_inst.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -61,14 +61,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -147,7 +147,7 @@ Instantiations - <html><span style="color:#000000;">a</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">a:</span>&nbsp;<span style="color:#000000;">A();</span></html> @@ -174,7 +174,7 @@ Instantiations - <html><span style="color:#000000;">b1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">();</span><br><span style="color:#000000;">b2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">b1:</span>&nbsp;<span style="color:#000000;">B();</span><br><span style="color:#000000;">b2:</span>&nbsp;<span style="color:#000000;">B();</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_via_inst.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_via_inst.relations.graphml index a08aeeaf2..bab239b3f 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_via_inst.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/evt_ref_via_inst.relations.graphml @@ -18,14 +18,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">B()</span></html> @@ -75,14 +75,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a:</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000000;">a:</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -113,14 +113,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/inits.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/inits.model.graphml index e3ab77583..13d4445f1 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/inits.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/inits.model.graphml @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">0</span><span style="color:#402020;">..</span><span style="color:#006100;">10</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#0061c0;">in</span>&nbsp;<span style="color:#0000ff;">any</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">0</span><span style="color:#402020;">..</span><span style="color:#006100;">10</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#0061c0;">in</span>&nbsp;<span style="color:#0000ff;">any</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">0</span><span style="color:#000000;">..</span><span style="color:#006100;">10</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#0061c0;">in</span>&nbsp;<span style="color:#0000ff;">any</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">0</span><span style="color:#000000;">..</span><span style="color:#006100;">10</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#0061c0;">in</span>&nbsp;<span style="color:#0000ff;">any</span><span style="color:#000000;">;</span></html> @@ -175,7 +175,7 @@ - <html><span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">1</span><span style="color:#402020;">,</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">&lt;</span>&nbsp;<span style="color:#006100;">2</span></html> + <html><span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">1</span><span style="color:#000000;">,</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">&lt;</span>&nbsp;<span style="color:#006100;">2</span></html> @@ -189,7 +189,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/insts.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/insts.model.graphml index 1358a953b..bb8785f1c 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/insts.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/insts.model.graphml @@ -10,14 +10,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">automaton</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">A()</span></html> @@ -63,14 +63,14 @@ - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G()</span></html> - <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">()</span></html> + <html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff;">group</span>&nbsp;<span style="color:#0000ff;">def</span>&nbsp;<span style="color:#000000;">G()</span></html> @@ -88,7 +88,7 @@ Instantiations - <html><span style="color:#000000;">a1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">();</span><br><span style="color:#000000;">a2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">();</span><br><span style="color:#000000;">a3</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">();</span><br><span style="color:#000000;">a4</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">();</span><br><span style="color:#000000;">a5</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">A</span><span style="color:#402020;">();</span><br><span style="color:#000000;">g1</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">();</span><br><span style="color:#000000;">g2</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">();</span><br><span style="color:#000000;">g3</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">();</span><br><span style="color:#000000;">g4</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">();</span><br><span style="color:#000000;">g5</span><span style="color:#402020;">:</span>&nbsp;<span style="color:#000000;">G</span><span style="color:#402020;">();</span></html> + <html><span style="color:#000000;">a1:</span>&nbsp;<span style="color:#000000;">A();</span><br><span style="color:#000000;">a2:</span>&nbsp;<span style="color:#000000;">A();</span><br><span style="color:#000000;">a3:</span>&nbsp;<span style="color:#000000;">A();</span><br><span style="color:#000000;">a4:</span>&nbsp;<span style="color:#000000;">A();</span><br><span style="color:#000000;">a5:</span>&nbsp;<span style="color:#000000;">A();</span><br><span style="color:#000000;">g1:</span>&nbsp;<span style="color:#000000;">G();</span><br><span style="color:#000000;">g2:</span>&nbsp;<span style="color:#000000;">G();</span><br><span style="color:#000000;">g3:</span>&nbsp;<span style="color:#000000;">G();</span><br><span style="color:#000000;">g4:</span>&nbsp;<span style="color:#000000;">G();</span><br><span style="color:#000000;">g5:</span>&nbsp;<span style="color:#000000;">G();</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/locs_edges.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/locs_edges.model.graphml index ef3f863cc..7f30446e3 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/locs_edges.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/locs_edges.model.graphml @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">controllable</span>&nbsp;<span style="color:#006100;">c_add</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">controllable</span>&nbsp;<span style="color:#006100;">c_remove</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">uncontrollable</span>&nbsp;<span style="color:#800000;">u_added</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">uncontrollable</span>&nbsp;<span style="color:#800000;">u_removed</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#c06100;">e_update</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#c06100;">e_snd</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#c06100;">e_rcv</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">0</span><span style="color:#402020;">..</span><span style="color:#006100;">10</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">x</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">0</span><span style="color:#402020;">..</span><span style="color:#006100;">10</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">y</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">0</span><span style="color:#402020;">..</span><span style="color:#006100;">10</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">z</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">controllable</span>&nbsp;<span style="color:#006100;">c_add</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">controllable</span>&nbsp;<span style="color:#006100;">c_remove</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">uncontrollable</span>&nbsp;<span style="color:#800000;">u_added</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">uncontrollable</span>&nbsp;<span style="color:#800000;">u_removed</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#c06100;">e_update</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#c06100;">e_snd</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#c06100;">e_rcv</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">0</span><span style="color:#000000;">..</span><span style="color:#006100;">10</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">x;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">0</span><span style="color:#000000;">..</span><span style="color:#006100;">10</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">y;</span><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">0</span><span style="color:#000000;">..</span><span style="color:#006100;">10</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">z;</span></html> @@ -87,7 +87,7 @@ - <html><span style="color:#006100;">c_add</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">0</span></html> + <html><span style="color:#006100;">c_add</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">0</span></html> @@ -125,7 +125,7 @@ - <html><span style="color:#c06100;">e_snd</span><span style="color:#402020;">!</span><span style="color:#000000;">x</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">0</span><br><span style="color:#0000ff;">now</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">:=</span>&nbsp;<span style="color:#000000;">x</span></html> + <html><span style="color:#c06100;">e_snd</span><span style="color:#000000;">!x</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">0</span><br><span style="color:#0000ff;">now</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">:=</span>&nbsp;<span style="color:#000000;">x</span></html> @@ -134,7 +134,7 @@ - <html><span style="color:#c06100;">e_rcv</span><span style="color:#402020;">?</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">:=</span>&nbsp;<span style="color:#402020;">?</span></html> + <html><span style="color:#c06100;">e_rcv</span><span style="color:#000000;">?</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">:=</span>&nbsp;<span style="color:#000000;">?</span></html> @@ -154,7 +154,7 @@ - <html><span style="color:#800000;">u_added</span><span style="color:#402020;">,</span>&nbsp;<span style="color:#800000;">u_removed</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">z</span>&nbsp;<span style="color:#402020;">:=</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#006100;">1</span></html> + <html><span style="color:#800000;">u_added</span><span style="color:#000000;">,</span>&nbsp;<span style="color:#800000;">u_removed</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">z</span>&nbsp;<span style="color:#000000;">:=</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#006100;">1</span></html> @@ -163,7 +163,7 @@ - <html><span style="color:#000000;">loc4</span><br><br><span style="color:#0000ff;">marked</span><span style="color:#402020;">;</span></html> + <html><span style="color:#000000;">loc4</span><br><br><span style="color:#0000ff;">marked</span><span style="color:#000000;">;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/locs_edges.relations.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/locs_edges.relations.graphml index 515238c3c..3e4a1dd6e 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/locs_edges.relations.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/locs_edges.relations.graphml @@ -127,7 +127,7 @@ - <html><span style="color:#402020;">?</span></html> + <html><span style="color:#000000;">?</span></html> @@ -138,7 +138,7 @@ - <html><span style="color:#402020;">!</span></html> + <html><span style="color:#000000;">!</span></html> @@ -288,7 +288,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#c06100;">e_rcv</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#c06100;">e_rcv</span>&nbsp;<span style="color:#000000;">!?~</span></html> @@ -300,7 +300,7 @@ - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#c06100;">e_snd</span>&nbsp;<span style="color:#402020;">!?~</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#c06100;">e_snd</span>&nbsp;<span style="color:#000000;">!?~</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/model_filter_all.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/model_filter_all.model.graphml index 28ca03340..599b830a4 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/model_filter_all.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/model_filter_all.model.graphml @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">alphabet</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">monitor</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">x</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">1</span><span style="color:#402020;">..</span><span style="color:#006100;">1</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">1</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">initial</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">marked</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">print</span>&nbsp;<span style="color:#c00000;">&quot;b&quot;</span>&nbsp;<span style="color:#0000ff;">for</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">alphabet</span>&nbsp;<span style="color:#000000;">e;</span><br><span style="color:#0000ff;">monitor</span>&nbsp;<span style="color:#000000;">e;</span><br><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">x;</span><br><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">1</span><span style="color:#000000;">..</span><span style="color:#006100;">1</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">1</span><span style="color:#000000;">;</span><br><br><span style="color:#0000ff;">initial</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">marked</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#000000;">;</span><br><br><span style="color:#0000ff;">print</span>&nbsp;<span style="color:#c00000;">&quot;b&quot;</span>&nbsp;<span style="color:#0000ff;">for</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -87,7 +87,7 @@ - <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#000000;">y</span><br><span style="color:#0000ff;">now</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">:=</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#006100;">1</span></html> + <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#000000;">y</span><br><span style="color:#0000ff;">now</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">:=</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#006100;">1</span></html> @@ -123,7 +123,7 @@ Declarations - <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c;</span></html> @@ -147,7 +147,7 @@ - <html><span style="color:#000000;">loc1</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">'</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5.0</span><span style="color:#402020;">;</span></html> + <html><span style="color:#000000;">loc1</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c'</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5.0</span><span style="color:#000000;">;</span></html> @@ -158,7 +158,7 @@ - <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#402020;">:=</span>&nbsp;<span style="color:#006100;">0.0</span></html> + <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#000000;">:=</span>&nbsp;<span style="color:#006100;">0.0</span></html> @@ -167,7 +167,7 @@ - <html><span style="color:#000000;">loc2</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">a.x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">'</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">6.0</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">urgent</span><span style="color:#402020;">;</span></html> + <html><span style="color:#000000;">loc2</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">a.x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#000000;">c;</span><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c'</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">6.0</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">urgent</span><span style="color:#000000;">;</span></html> @@ -183,7 +183,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">print</span>&nbsp;<span style="color:#c00000;">&quot;a&quot;</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span><br><br><span style="color:#0000ff;">print</span>&nbsp;<span style="color:#c00000;">&quot;a&quot;</span><span style="color:#000000;">;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/model_filter_default.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/model_filter_default.model.graphml index aa675d055..4978ea796 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/model_filter_default.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/model_filter_default.model.graphml @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">alphabet</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">monitor</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">x</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#402020;">[</span><span style="color:#006100;">1</span><span style="color:#402020;">..</span><span style="color:#006100;">1</span><span style="color:#402020;">]</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">1</span><span style="color:#402020;">;</span><br><br><span style="color:#0000ff;">initial</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">marked</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">alphabet</span>&nbsp;<span style="color:#000000;">e;</span><br><span style="color:#0000ff;">monitor</span>&nbsp;<span style="color:#000000;">e;</span><br><br><span style="color:#0000ff;">disc</span>&nbsp;<span style="color:#0000ff;">int</span>&nbsp;<span style="color:#000000;">x;</span><br><span style="color:#0000ff;">const</span>&nbsp;<span style="color:#0000ff;">int</span><span style="color:#000000;">[</span><span style="color:#006100;">1</span><span style="color:#000000;">..</span><span style="color:#006100;">1</span><span style="color:#000000;">]</span>&nbsp;<span style="color:#000000;">y</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">1</span><span style="color:#000000;">;</span><br><br><span style="color:#0000ff;">initial</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">marked</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><span style="color:#000000;">;</span></html> @@ -87,7 +87,7 @@ - <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#000000;">y</span><br><span style="color:#0000ff;">now</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">:=</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#006100;">1</span></html> + <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#000000;">y</span><br><span style="color:#0000ff;">now</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">:=</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#006100;">1</span></html> @@ -123,7 +123,7 @@ Declarations - <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">c;</span></html> @@ -147,7 +147,7 @@ - <html><span style="color:#000000;">loc1</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">'</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">5.0</span><span style="color:#402020;">;</span></html> + <html><span style="color:#000000;">loc1</span><br><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c'</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">5.0</span><span style="color:#000000;">;</span></html> @@ -158,7 +158,7 @@ - <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#402020;">:=</span>&nbsp;<span style="color:#006100;">0.0</span></html> + <html><span style="color:#000000;">e</span><br><span style="color:#0000ff;">when</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#006100;">2</span><br><span style="color:#0000ff;">do</span>&nbsp;<span style="color:#000000;">c</span>&nbsp;<span style="color:#000000;">:=</span>&nbsp;<span style="color:#006100;">0.0</span></html> @@ -167,7 +167,7 @@ - <html><span style="color:#000000;">loc2</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">a.x</span>&nbsp;<span style="color:#402020;">&gt;</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c</span><span style="color:#402020;">'</span>&nbsp;<span style="color:#402020;">=</span>&nbsp;<span style="color:#006100;">6.0</span><span style="color:#402020;">;</span><br><span style="color:#0000ff;">urgent</span><span style="color:#402020;">;</span></html> + <html><span style="color:#000000;">loc2</span><br><br><span style="color:#0000ff;">invariant</span>&nbsp;<span style="color:#000000;">a.x</span>&nbsp;<span style="color:#000000;">&gt;</span>&nbsp;<span style="color:#000000;">c;</span><br><span style="color:#0000ff;">equation</span>&nbsp;<span style="color:#000000;">c'</span>&nbsp;<span style="color:#000000;">=</span>&nbsp;<span style="color:#006100;">6.0</span><span style="color:#000000;">;</span><br><span style="color:#0000ff;">urgent</span><span style="color:#000000;">;</span></html> @@ -183,7 +183,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/rel_cont_der.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/rel_cont_der.model.graphml index 3972df415..3cc8534c6 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/rel_cont_der.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/rel_cont_der.model.graphml @@ -12,7 +12,7 @@ Declarations - <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#402020;">+</span>&nbsp;<span style="color:#000000;">x</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">cont</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#0000ff;">der</span>&nbsp;<span style="color:#000000;">x</span>&nbsp;<span style="color:#000000;">+</span>&nbsp;<span style="color:#000000;">x;</span></html> diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/small.model.graphml b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/small.model.graphml index 69eecb6dc..5700298aa 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2yed/small.model.graphml +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2yed/small.model.graphml @@ -34,7 +34,7 @@ Declarations - <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">event</span>&nbsp;<span style="color:#000000;">e;</span></html> @@ -58,7 +58,7 @@ - <html><span style="color:#0000ff;">marked</span><span style="color:#402020;">;</span></html> + <html><span style="color:#0000ff;">marked</span><span style="color:#000000;">;</span></html> -- GitLab From 8b0f34c797d0fd46a0f67dfae468d85f1e6829fb Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Tue, 6 Sep 2022 20:02:13 +0200 Subject: [PATCH 09/51] #398 Prevent crash for check violations reported on the top level scope. --- .../checkers/checks/CompNoInitPredsCheck.java | 7 ++++++- .../CompOnlyVarValueMarkerPredsCheck.java | 21 +++++++++++++++---- .../checks/CompStateInvsOnlyReqsCheck.java | 8 ++++++- .../InvNoKindlessStateEvtExclCheck.java | 11 ++++++++-- .../tests/cif2supremica/invalid1.cif | 17 ++++++++++----- .../invalid1.cif.cif2supremica.err | 4 ++++ 6 files changed, 55 insertions(+), 13 deletions(-) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java index dca9c7640..ebcee4a4c 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java @@ -16,6 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.Specification; /** * CIF check that does not allow initialization predicates in components, i.e., does not allow initialization predicates @@ -25,7 +26,11 @@ public class CompNoInitPredsCheck extends CifCheck { @Override protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { if (!comp.getInitials().isEmpty()) { - violations.add(comp, "component contains an initialization predicate"); + if (comp instanceof Specification) { + violations.add(null, "top level scope of the specification contains an initialization predicate"); + } else { + violations.add(comp, "component contains an initialization predicate"); + } } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java index 25a6583a4..e0eaede8a 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java @@ -20,6 +20,7 @@ import java.util.Map; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryOperator; @@ -39,14 +40,26 @@ public class CompOnlyVarValueMarkerPredsCheck extends CifCheck { for (Expression marked: comp.getMarkeds()) { // The only supported form is 'discrete_variable = marked_value'. if (!(marked instanceof BinaryExpression)) { - violations.add(comp, "component has a marker predicate that is not of the form " - + "\"discrete_variable = marked_value\""); + if (comp instanceof Specification) { + violations.add(null, + "top level scope of the specification has a marker predicate that is not of the form " + + "\"discrete_variable = marked_value\""); + } else { + violations.add(comp, "component has a marker predicate that is not of the form " + + "\"discrete_variable = marked_value\""); + } continue; } BinaryExpression bexpr = (BinaryExpression)marked; if (bexpr.getOperator() != BinaryOperator.EQUAL || !(bexpr.getLeft() instanceof DiscVariableExpression)) { - violations.add(comp, "component has a marker predicate that is not of the form " - + "\"discrete_variable = marked_value\""); + if (comp instanceof Specification) { + violations.add(null, + "top level scope of the specification has a marker predicate that is not of the form " + + "\"discrete_variable = marked_value\""); + } else { + violations.add(comp, "component has a marker predicate that is not of the form " + + "\"discrete_variable = marked_value\""); + } continue; } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java index 5c83307ed..944a52462 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java @@ -21,6 +21,7 @@ import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; import org.eclipse.escet.cif.metamodel.cif.InvKind; import org.eclipse.escet.cif.metamodel.cif.Invariant; +import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.cif.metamodel.cif.SupKind; /** CIF check that allows state invariants in components only if they are requirement invariants. */ @@ -32,7 +33,12 @@ public class CompStateInvsOnlyReqsCheck extends CifCheck { SupKind supKind = inv.getSupKind(); if (supKind != SupKind.REQUIREMENT) { String kindTxt = (supKind == SupKind.NONE) ? "kindless" : CifTextUtils.kindToStr(supKind); - violations.add(comp, fmt("component has a %s state invariant", kindTxt)); + if (comp instanceof Specification) { + violations.add(null, + fmt("top level scope of the specification has a %s state invariant", kindTxt)); + } else { + violations.add(comp, fmt("component has a %s state invariant", kindTxt)); + } } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java index 245176737..ee6e27b63 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java @@ -18,6 +18,7 @@ import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; import org.eclipse.escet.cif.metamodel.cif.InvKind; import org.eclipse.escet.cif.metamodel.cif.Invariant; +import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.cif.metamodel.cif.SupKind; import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; import org.eclipse.escet.cif.metamodel.cif.automata.Location; @@ -30,8 +31,14 @@ public class InvNoKindlessStateEvtExclCheck extends CifCheck { if (inv.getInvKind() == InvKind.EVENT_NEEDS || inv.getInvKind() == InvKind.EVENT_DISABLES) { SupKind supKind = inv.getSupKind(); if (supKind == SupKind.NONE) { - violations.add(comp, - "component has a kindless state/event exclusion invariant, lacking a supervisory kind"); + if (comp instanceof Specification) { + violations.add(null, + "top level scope of the specification has a kindless state/event exclusion invariant, " + + "lacking a supervisory kind"); + } else { + violations.add(comp, + "component has a kindless state/event exclusion invariant, lacking a supervisory kind"); + } } } } diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif index f06ff0181..6d3423501 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif @@ -66,12 +66,12 @@ group g: initial; end - initial 1=1; // Initial in component. + initial 1 = 1; // Initial in component. - marked not false; // Marker in component: not bin expr. - marked 1 > 2; // Marked in component: not '=' bin expr. - marked 2 = 2; // Marked in component: not 'dvar = value'. - marked p0.cnt = 1.2; // Marked in component: not 'dvar = value'. + marked not false; // Marker predicate in component: not bin expr. + marked 1 > 2; // Marker predicate in component: not '=' bin expr. + marked 2 = 2; // Marker predicate in component: not 'dvar = value'. + marked p0.cnt = 1.2; // Marker predicate in component: not 'dvar = value'. marked p0.x1 = 1; // Duplicate marker predicate. marked p0.x1 = 1; // Duplicate marker predicate. @@ -91,3 +91,10 @@ group g: return p; end end + +invariant 11 = 11; // Non requirement invariant in top level scope of specification. +initial 2 = 2; // Initial in top level scope of specification. +marked 3 > 4; // Marker predicate in top level scope of specification. +marked true; // Marker predicate in top level scope of specification. + +invariant g.e1 needs 3 = 3; // Kindless state/event exclusion invariant in top level scope of the specification. diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err index 764cb6f25..a55a5b5a7 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err @@ -57,3 +57,7 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g.p1": uses unary operator "-" on an operand of type "real" in unary expression "-2.0". - Unsupported "g.p2": automata has multiple (2) initial locations. - Unsupported "g.snd": automaton has an urgent edge. + - Unsupported specification: top level scope of the specification contains an initialization predicate. + - Unsupported specification: top level scope of the specification has a kindless state invariant. + - Unsupported specification: top level scope of the specification has a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported specification: top level scope of the specification has a marker predicate that is not of the form "discrete_variable = marked_value". -- GitLab From 82a58f401be9541a53661331b535c4adfb17b168 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Tue, 6 Sep 2022 20:05:54 +0200 Subject: [PATCH 10/51] #398 Small improvements to test model comments. --- .../tests/cif2supremica/invalid1.cif | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif index 6d3423501..ecc8d6004 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif @@ -66,7 +66,7 @@ group g: initial; end - initial 1 = 1; // Initial in component. + initial 1 = 1; // Initialization predicate in component. marked not false; // Marker predicate in component: not bin expr. marked 1 > 2; // Marker predicate in component: not '=' bin expr. @@ -92,8 +92,8 @@ group g: end end -invariant 11 = 11; // Non requirement invariant in top level scope of specification. -initial 2 = 2; // Initial in top level scope of specification. +invariant 11 = 11; // Non-requirement invariant in top level scope of specification. +initial 2 = 2; // Initialization predicate in top level scope of specification. marked 3 > 4; // Marker predicate in top level scope of specification. marked true; // Marker predicate in top level scope of specification. -- GitLab From 5a39bd1f68e12c7a10963dc55f5b6ff5db7614a6 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Tue, 6 Sep 2022 20:25:06 +0200 Subject: [PATCH 11/51] #398 CIF check violation reporting improvements. - Allow reporting violations on both 'Specification' and 'null'. - Allow reporting on non-named object. - Introduced message trees to build up more complex messages. - Improved JavaDoc with violation reporting instructions. - Added CifTextUtils.getTypeDescriptionForNamedObject. --- .../cif/common/CifPreconditionChecker.java | 12 ++- .../escet/cif/common/CifTextUtils.java | 101 ++++++++++++++++++ .../common/checkers/CifCheckViolation.java | 90 +++++++++++++--- .../common/checkers/CifCheckViolations.java | 26 +++-- .../messages/CifCheckViolationMessage.java | 33 ++++++ .../messages/IfReportOnAncestorMessage.java | 65 +++++++++++ .../messages/IfReportOnSelfMessage.java | 65 +++++++++++ .../checkers/messages/LiteralMessage.java | 53 +++++++++ .../ReportObjectTypeDescriptionMessage.java | 39 +++++++ .../checkers/messages/SequenceMessage.java | 58 ++++++++++ 10 files changed, 515 insertions(+), 27 deletions(-) create mode 100644 cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/CifCheckViolationMessage.java create mode 100644 cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java create mode 100644 cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java create mode 100644 cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java create mode 100644 cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescriptionMessage.java create mode 100644 cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifPreconditionChecker.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifPreconditionChecker.java index fe13fe670..807b7199d 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifPreconditionChecker.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifPreconditionChecker.java @@ -13,8 +13,8 @@ package org.eclipse.escet.cif.common; -import java.util.Collections; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import org.eclipse.escet.cif.common.checkers.CifCheck; @@ -22,6 +22,7 @@ import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.CifChecker; import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; +import org.eclipse.escet.common.java.Sets; import org.eclipse.escet.common.java.Strings; /** @@ -61,10 +62,11 @@ public class CifPreconditionChecker extends CifChecker { // Report unsupported specification, if there are any precondition violations. if (violations.hasViolations()) { - List messages = violations.getViolations().map(v -> "Unsupported " + v.toString()) - .collect(Collectors.toList()); - Collections.sort(messages, Strings.SORTER); - String msg = toolName + " failed due to unsatisfied preconditions:\n - " + String.join("\n - ", messages); + Set messages = violations.getViolations().map(v -> "Unsupported " + v.toString()) + .collect(Collectors.toSet()); + List sortedMessages = Sets.sortedgeneric(messages, Strings.SORTER); + String msg = toolName + " failed due to unsatisfied preconditions:\n - " + + String.join("\n - ", sortedMessages); throw new UnsupportedException(msg); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifTextUtils.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifTextUtils.java index ccddbc5d3..27b03b0ee 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifTextUtils.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/CifTextUtils.java @@ -27,9 +27,11 @@ import org.eclipse.escet.cif.metamodel.cif.AlgParameter; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; import org.eclipse.escet.cif.metamodel.cif.Component; import org.eclipse.escet.cif.metamodel.cif.ComponentDef; +import org.eclipse.escet.cif.metamodel.cif.ComponentInst; import org.eclipse.escet.cif.metamodel.cif.ComponentParameter; import org.eclipse.escet.cif.metamodel.cif.Equation; import org.eclipse.escet.cif.metamodel.cif.EventParameter; +import org.eclipse.escet.cif.metamodel.cif.Group; import org.eclipse.escet.cif.metamodel.cif.Invariant; import org.eclipse.escet.cif.metamodel.cif.LocationParameter; import org.eclipse.escet.cif.metamodel.cif.Parameter; @@ -50,6 +52,7 @@ import org.eclipse.escet.cif.metamodel.cif.declarations.EnumDecl; import org.eclipse.escet.cif.metamodel.cif.declarations.EnumLiteral; import org.eclipse.escet.cif.metamodel.cif.declarations.Event; import org.eclipse.escet.cif.metamodel.cif.declarations.InputVariable; +import org.eclipse.escet.cif.metamodel.cif.declarations.TypeDecl; import org.eclipse.escet.cif.metamodel.cif.expressions.AlgVariableExpression; import org.eclipse.escet.cif.metamodel.cif.expressions.BaseFunctionExpression; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; @@ -1597,4 +1600,102 @@ public class CifTextUtils { return getComponentText2((ComplexComponent)locOrComp); } } + + /** + * Returns a description of the type of named object that is provided: + *
    + *
  • {@link AlgVariable}: {@code "algebraic variable"} or {@code "algebraic parameter"}
  • + *
  • {@link Automaton}: {@code "automaton"} or {@code "automaton definition"}
  • + *
  • {@link ComponentDef}: {@code "automaton definition"} or {@code "group definition"}
  • + *
  • {@link ComponentInst}: {@code "component instantiation"}
  • + *
  • {@link Constant}: {@code "constant"}
  • + *
  • {@link ContVariable}: {@code "continuous variable"}
  • + *
  • {@link DiscVariable}: {@code "discrete variable"}, {@code "function variable"} or + * {@code "function parameter"}
  • + *
  • {@link EnumDecl}: {@code "enumeration declaration"}
  • + *
  • {@link EnumLiteral}: {@code "enumeration literal"}
  • + *
  • {@link Event}: {@code "event"} or {@code "event parameter"}
  • + *
  • {@link Function}: {@code "user-defined function"}
  • + *
  • {@link FunctionParameter}: {@code "function parameter"}
  • + *
  • {@link Group}: {@code "group"} or {@code "group definition"}
  • + *
  • {@link InputVariable}: {@code "input variable"}
  • + *
  • {@link Invariant}: {@code "invariant"}
  • + *
  • {@link Location}: {@code "location"} or {@code "location parameter"}
  • + *
  • {@link Parameter}: {@code "algebraic parameter"}, {@code "component parameter"}, {@code "event parameter"} or + * {@code "location parameter"}
  • + *
  • {@link TypeDecl}: {@code "type declaration"}
  • + *
+ * + * @param obj The {@link #hasName named object}. + * @return The object type description. + * @see #hasName + */ + public static String getTypeDescriptionForNamedObject(PositionObject obj) { + Assert.check(hasName(obj)); + + if (obj instanceof AlgVariable) { + return (obj.eContainer() instanceof Parameter) ? "algebraic parameter" : "algebraic variable"; + } else if (obj instanceof Automaton) { + return (obj.eContainer() instanceof ComponentDef) ? "automaton definition" : "automaton"; + } else if (obj instanceof ComponentDef) { + ComplexComponent body = ((ComponentDef)obj).getBody(); + if (body instanceof Automaton) { + return "automaton definition"; + } else if (body instanceof Group) { + return "group definition"; + } else { + throw new RuntimeException("Unknown component definition body: " + body); + } + } else if (obj instanceof ComponentInst) { + return "component instantiation"; + } else if (obj instanceof Constant) { + return "constant"; + } else if (obj instanceof ContVariable) { + return "continuous variable"; + } else if (obj instanceof DiscVariable) { + if (obj.eContainer() instanceof Function) { + return "function variable"; + } else if (obj.eContainer() instanceof FunctionParameter) { + return "function parameter"; + } else { + Assert.check(obj.eContainer() instanceof Automaton); + return "discrete variable"; + } + } else if (obj instanceof EnumDecl) { + return "enumeration declaration"; + } else if (obj instanceof EnumLiteral) { + return "enumeration literal"; + } else if (obj instanceof Event) { + return (obj.eContainer() instanceof Parameter) ? "event parameter" : "event"; + } else if (obj instanceof Function) { + return "user-defined function"; + } else if (obj instanceof FunctionParameter) { + return "function parameter"; + } else if (obj instanceof Group) { + // Specifications don't have a name, and are thus not supported. + return (obj.eContainer() instanceof ComponentDef) ? "group definition" : "group"; + } else if (obj instanceof InputVariable) { + return "input variable"; + } else if (obj instanceof Invariant) { + return "invariant"; + } else if (obj instanceof Location) { + return (obj.eContainer() instanceof Parameter) ? "location parameter" : "location"; + } else if (obj instanceof Parameter) { + if (obj instanceof AlgParameter) { + return "algebraic parameter"; + } else if (obj instanceof ComponentParameter) { + return "component parameter"; + } else if (obj instanceof EventParameter) { + return "event parameter"; + } else if (obj instanceof LocationParameter) { + return "location parameter"; + } else { + throw new RuntimeException("Unexpected component definition parameter: " + obj); + } + } else if (obj instanceof TypeDecl) { + return "type declaration"; + } else { + throw new RuntimeException("Unexpected object: " + obj); + } + } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java index ffb3c84f4..a4c47e919 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java @@ -18,34 +18,89 @@ import static org.eclipse.escet.common.java.Strings.fmt; import java.util.Objects; import org.eclipse.escet.cif.common.CifTextUtils; +import org.eclipse.escet.cif.common.checkers.messages.CifCheckViolationMessage; +import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.common.java.Assert; import org.eclipse.escet.common.position.metamodel.position.PositionObject; /** CIF check condition violation. */ public class CifCheckViolation { /** - * The named CIF object for which the violation is reported, or {@code null} to report it for the CIF specification. + * The provided CIF object for which the violation is to be reported. May be {@code null} to report for the CIF + * specification. Is never a {@link Specification}. If it is not a named CIF object, the violation is reported on + * its closest named ancestor. */ - private final PositionObject cifObject; + private final PositionObject providedReportObject; + + /** + * The named CIF object on which the violation is to be reported, or {@code null} to report it on the CIF + * specification. + */ + private final PositionObject actualReportObject; /** The message describing the violation. */ - private final String message; + private final CifCheckViolationMessage message; /** * Constructor for the {@link CifCheckViolation} class. * - * @param cifObject The named CIF object for which the violation is reported, or {@code null} to report it for the - * CIF specification. - * @param message The message describing the violation. E.g., {@code "event is a channel"}, - * {@code "automaton is a kindless automaton, lacking a supervisory kind"} or - * {@code "specification has no automata"}. + * @param cifObject The CIF object for which the violation is to be reported. Note that: + *
    + *
  • If this object itself is not named, then the {@link CifTextUtils#getNamedSelfOrAncestor closest named + * ancestor} is used instead.
  • + *
  • If the object itself is not named, and has no named ancestor, the specification is used.
  • + *
  • To report a violation on an entire specification, either a {@link Specification} or {@code null} may be + * provided.
  • + *
+ * @param message The message describing the violation. + * @see CifCheckViolations#add */ - public CifCheckViolation(PositionObject cifObject, String message) { - this.cifObject = cifObject; + public CifCheckViolation(PositionObject cifObject, CifCheckViolationMessage message) { + // Store provided object. Normalize to single representation (null) for specifications. + this.providedReportObject = (cifObject instanceof Specification) ? null : cifObject; + + // Store report object. Never a 'Specification'. May be 'null'. + this.actualReportObject = (providedReportObject == null) ? null + : CifTextUtils.getNamedSelfOrAncestor(providedReportObject); + Assert.implies(this.actualReportObject != null, CifTextUtils.hasName(actualReportObject)); + + // Store message. this.message = message; - if (cifObject != null) { - Assert.check(CifTextUtils.hasName(cifObject), cifObject); + } + + /** + * Is the violation being reported on the provided CIF object? + * + * @return {@code true} if the violation being reported on the provided CIF object, {@code false} if it is being + * reported on an ancestor of that object. + */ + public boolean isReportOnSelf() { + return providedReportObject == actualReportObject; + } + + /** + * Is the violation being reported on a CIF specification? + * + * @return {@code true} if it is being reported on a CIF specification, {@code false} if it is being reported on + * some named CIF object. + */ + public boolean isReportOnSpecification() { + return actualReportObject == null; + } + + /** + * Returns the named CIF object on which the violation is to be reported. + * + * @return The named CIF object on which the violation is to be reported. + * @throws IllegalStateException If the violation is to be reported pm the CIF specification, rather than on a named + * CIF object. + * @see #isReportOnSpecification + */ + public PositionObject getReportObject() { + if (actualReportObject == null) { + throw new IllegalStateException(); } + return actualReportObject; } @Override @@ -57,17 +112,20 @@ public class CifCheckViolation { return false; } CifCheckViolation that = (CifCheckViolation)obj; - return this.cifObject == that.cifObject && this.message.equals(that.message); + return this.providedReportObject == that.providedReportObject + && this.actualReportObject == that.actualReportObject && this.message.equals(that.message); } @Override public int hashCode() { - return Objects.hash(cifObject, message); + return Objects.hash(providedReportObject, actualReportObject, message); } @Override public String toString() { - String name = (cifObject == null) ? "specification" : "\"" + CifTextUtils.getAbsName(cifObject) + "\""; - return fmt("%s: %s.", name, message); + String name = (actualReportObject == null) ? "specification" + : "\"" + CifTextUtils.getAbsName(actualReportObject) + "\""; + String messageText = message.getMessage(this); + return fmt("%s: %s.", name, messageText); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java index 765f72490..91e25e979 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java @@ -15,9 +15,15 @@ package org.eclipse.escet.cif.common.checkers; import static org.eclipse.escet.common.java.Sets.set; +import java.util.Arrays; import java.util.Set; import java.util.stream.Stream; +import org.eclipse.escet.cif.common.CifTextUtils; +import org.eclipse.escet.cif.common.checkers.messages.CifCheckViolationMessage; +import org.eclipse.escet.cif.common.checkers.messages.SequenceMessage; +import org.eclipse.escet.cif.metamodel.cif.Specification; +import org.eclipse.escet.common.java.Assert; import org.eclipse.escet.common.position.metamodel.position.PositionObject; /** CIF check condition violations. */ @@ -46,13 +52,21 @@ public class CifCheckViolations { /** * Add a violation. * - * @param cifObject The named CIF object for which the violation is reported, or {@code null} to report it for the - * CIF specification. - * @param message The message describing the violation. E.g., {@code "event is a channel"}, - * {@code "automaton is a kindless automaton, lacking a supervisory kind"} or - * {@code "specification has no automata"}. + * @param cifObject The CIF object for which the violation is to be reported. Note that: + *
    + *
  • If this object itself is not named, then the {@link CifTextUtils#getNamedSelfOrAncestor closest named + * ancestor} is used instead.
  • + *
  • If the object itself is not named, and has no named ancestor, the specification is used.
  • + *
  • To report a violation on an entire specification, either a {@link Specification} or {@code null} may be + * provided.
  • + *
+ * @param messages The non-empty sequence of concatenated messages describing the violation. + * @see CifCheckViolation#CifCheckViolation */ - public void add(PositionObject cifObject, String message) { + public void add(PositionObject cifObject, CifCheckViolationMessage... messages) { + Assert.check(messages.length > 0); + CifCheckViolationMessage message = (messages.length == 1) ? messages[0] + : new SequenceMessage(Arrays.asList(messages)); violations.add(new CifCheckViolation(cifObject, message)); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/CifCheckViolationMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/CifCheckViolationMessage.java new file mode 100644 index 000000000..5705235d0 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/CifCheckViolationMessage.java @@ -0,0 +1,33 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers.messages; + +import org.eclipse.escet.cif.common.checkers.CifCheckViolation; + +/** A CIF check violation message. */ +public abstract class CifCheckViolationMessage { + /** + * Returns the violation message text. + * + * @param violation The CIF check violation. + * @return The violation message text. + */ + public abstract String getMessage(CifCheckViolation violation); + + @Override + public abstract boolean equals(Object obj); + + @Override + public abstract int hashCode(); +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java new file mode 100644 index 000000000..c8f3748d5 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java @@ -0,0 +1,65 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers.messages; + +import org.eclipse.escet.cif.common.checkers.CifCheckViolation; + +/** + * Message that is conditional on the violation being reported on an ancestor of the object, rather than on the object + * itself. Is an empty message if the violation is reported on the object itself. + */ +public class IfReportOnAncestorMessage extends CifCheckViolationMessage { + /** The message to use if the violation is reported on an ancestor of the object. */ + private final CifCheckViolationMessage message; + + /** + * Constructor for the {@link IfReportOnAncestorMessage} class. + * + * @param message The literal message to use if the violation is reported on an ancestor of the object. + */ + public IfReportOnAncestorMessage(String message) { + this(new LiteralMessage(message)); + } + + /** + * Constructor for the {@link IfReportOnAncestorMessage} class. + * + * @param message The message to use if the violation is reported on an ancestor of the object. + */ + public IfReportOnAncestorMessage(CifCheckViolationMessage message) { + this.message = message; + } + + @Override + public String getMessage(CifCheckViolation violation) { + return violation.isReportOnSelf() ? "" : message.getMessage(violation); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof IfReportOnAncestorMessage)) { + return false; + } + IfReportOnAncestorMessage that = (IfReportOnAncestorMessage)other; + return this.message.equals(that.message); + } + + @Override + public int hashCode() { + return message.hashCode(); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java new file mode 100644 index 000000000..d4edf8046 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java @@ -0,0 +1,65 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers.messages; + +import org.eclipse.escet.cif.common.checkers.CifCheckViolation; + +/** + * Message that is conditional on the violation being reported on the object itself, rather than on one of its + * ancestors. Is an empty message if the violation is reported on one of the ancestors of the object. + */ +public class IfReportOnSelfMessage extends CifCheckViolationMessage { + /** The message to use if the violation is reported on the object itself. */ + private final CifCheckViolationMessage message; + + /** + * Constructor for the {@link IfReportOnSelfMessage} class. + * + * @param message The literal message to use if the violation is reported on the object itself. + */ + public IfReportOnSelfMessage(String message) { + this(new LiteralMessage(message)); + } + + /** + * Constructor for the {@link IfReportOnSelfMessage} class. + * + * @param message The message to use if the violation is reported on the object itself. + */ + public IfReportOnSelfMessage(CifCheckViolationMessage message) { + this.message = message; + } + + @Override + public String getMessage(CifCheckViolation violation) { + return violation.isReportOnSelf() ? message.getMessage(violation) : ""; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof IfReportOnSelfMessage)) { + return false; + } + IfReportOnSelfMessage that = (IfReportOnSelfMessage)other; + return this.message.equals(that.message); + } + + @Override + public int hashCode() { + return message.hashCode(); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java new file mode 100644 index 000000000..e232cc843 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers.messages; + +import org.eclipse.escet.cif.common.checkers.CifCheckViolation; + +/** A literal message. */ +public class LiteralMessage extends CifCheckViolationMessage { + /** The message. */ + private final String message; + + /** + * Constructor for the {@link LiteralMessage} class. + * + * @param message The message. + */ + public LiteralMessage(String message) { + this.message = message; + } + + @Override + public String getMessage(CifCheckViolation violation) { + return message; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof LiteralMessage)) { + return false; + } + LiteralMessage that = (LiteralMessage)other; + return this.message.equals(that.message); + } + + @Override + public int hashCode() { + return message.hashCode(); + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescriptionMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescriptionMessage.java new file mode 100644 index 000000000..8c2470faa --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescriptionMessage.java @@ -0,0 +1,39 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers.messages; + +import org.eclipse.escet.cif.common.CifTextUtils; +import org.eclipse.escet.cif.common.checkers.CifCheckViolation; + +/** Message describing the CIF object on which the violation is reported. */ +public class ReportObjectTypeDescriptionMessage extends CifCheckViolationMessage { + @Override + public String getMessage(CifCheckViolation violation) { + return violation.isReportOnSpecification() ? "the top level scope of the specification" + : CifTextUtils.getTypeDescriptionForNamedObject(violation.getReportObject()); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + return other instanceof SequenceMessage; + } + + @Override + public int hashCode() { + return 0; + } +} diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java new file mode 100644 index 000000000..6634375c4 --- /dev/null +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java @@ -0,0 +1,58 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.common.checkers.messages; + +import java.util.List; +import java.util.stream.Collectors; + +import org.eclipse.escet.cif.common.checkers.CifCheckViolation; +import org.eclipse.escet.common.java.Assert; + +/** A message that is a concatenation of a non-empty sequence of messages. */ +public class SequenceMessage extends CifCheckViolationMessage { + /** The non-empty sequence of messages. */ + private final List messages; + + /** + * Constructor for the {@link SequenceMessage} class. + * + * @param messages The non-empty sequence of messages. + */ + public SequenceMessage(List messages) { + Assert.check(!messages.isEmpty()); + this.messages = messages; + } + + @Override + public String getMessage(CifCheckViolation violation) { + return messages.stream().map(m -> m.getMessage(violation)).collect(Collectors.joining()); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof SequenceMessage)) { + return false; + } + SequenceMessage that = (SequenceMessage)other; + return this.messages.equals(that.messages); + } + + @Override + public int hashCode() { + return messages.hashCode(); + } +} -- GitLab From e1d7a87ae1a52cfc99fe0ff5489e939f5c4f0bc1 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 11 Sep 2022 19:00:33 +0200 Subject: [PATCH 12/51] #398 Updated checks for violation reporting changes. --- .../checkers/checks/AutNoKindlessCheck.java | 5 +- .../checks/AutOnlyWithOneInitLocCheck.java | 19 ++++---- .../checkers/checks/CompNoInitPredsCheck.java | 10 ++-- .../CompOnlyVarValueMarkerPredsCheck.java | 26 ++++------ .../checks/CompStateInvsOnlyReqsCheck.java | 11 ++--- .../checkers/checks/EdgeNoIfUpdatesCheck.java | 23 ++------- .../checks/EdgeNoMultiAssignCheck.java | 23 ++------- .../checks/EdgeNoPartialVarAssignCheck.java | 23 ++------- .../checkers/checks/EdgeNoUrgentCheck.java | 12 ++--- .../checkers/checks/EventNoChannelsCheck.java | 5 +- .../checkers/checks/EventNoTauCheck.java | 27 ++++------- .../EventOnlyWithControllabilityCheck.java | 33 ++++--------- .../ExprNoSpecificBinaryExprsCheck.java | 10 ++-- .../checks/ExprNoSpecificExprsCheck.java | 4 +- .../checks/ExprNoSpecificUnaryExprsCheck.java | 13 ++--- .../checks/FuncNoUserDefinedCheck.java | 3 +- .../InvNoKindlessStateEvtExclCheck.java | 48 +++++-------------- .../checkers/checks/LocNoStateInvsCheck.java | 21 ++++---- .../checkers/checks/LocNoUrgentCheck.java | 22 +++------ .../LocOnlyStaticEvalMarkerPredsCheck.java | 36 +++++--------- .../checks/TypeNoSpecificTypesCheck.java | 4 +- .../checkers/checks/VarNoContinuousCheck.java | 3 +- .../VarNoDiscWithMultiInitValuesCheck.java | 9 ++-- .../checkers/checks/VarNoInputCheck.java | 3 +- 24 files changed, 139 insertions(+), 254 deletions(-) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java index 46d40c1c4..44f8f2e64 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java @@ -15,6 +15,8 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.SupKind; import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; @@ -23,7 +25,8 @@ public class AutNoKindlessCheck extends CifCheck { @Override protected void preprocessAutomaton(Automaton aut, CifCheckViolations violations) { if (aut.getKind() == SupKind.NONE) { - violations.add(aut, "automaton is a kindless automaton, lacking a supervisory kind"); + violations.add(aut, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" is a kindless automaton, lacking a supervisory kind")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java index dd49665c7..4807ce5c9 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java @@ -20,6 +20,9 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.CifEvalException; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.LocationParameter; import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; import org.eclipse.escet.cif.metamodel.cif.automata.Location; @@ -46,9 +49,11 @@ public class AutOnlyWithOneInitLocCheck extends CifCheck { protected void postprocessAutomaton(Automaton aut, CifCheckViolations violations) { // There must be exactly one initial location. if (initLocCount == 0) { - violations.add(aut, "automaton has no initial location"); + violations.add(aut, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" has no initial location")); } else if (initLocCount > 1) { - violations.add(aut, fmt("automata has multiple (%d) initial locations", initLocCount)); + violations.add(aut, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(fmt(" has multiple (%d) initial locations", initLocCount))); } // Skip if check is disabled (negative value). } @@ -74,12 +79,10 @@ public class AutOnlyWithOneInitLocCheck extends CifCheck { errMsg = "as evaluating one of its initialization predicates resulted in an evaluation error"; } if (errMsg != null) { - if (loc.getName() != null) { - violations.add(loc, "failed to determine whether this is an initial location, " + errMsg); - } else { - violations.add((Automaton)loc.eContainer(), - "failed to determine whether the automaton's location is an initial location, " + errMsg); - } + // Report violation on the location, or on its automaton in case the location has no name. + violations.add(loc, new LiteralMessage("failed to determine whether the "), + new IfReportOnAncestorMessage("automaton's "), + new LiteralMessage("location is an initial location, " + errMsg)); // Disable initial location count checking. initLocCount = -1; diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java index ebcee4a4c..c8f178f97 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java @@ -15,8 +15,9 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; -import org.eclipse.escet.cif.metamodel.cif.Specification; /** * CIF check that does not allow initialization predicates in components, i.e., does not allow initialization predicates @@ -26,11 +27,8 @@ public class CompNoInitPredsCheck extends CifCheck { @Override protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { if (!comp.getInitials().isEmpty()) { - if (comp instanceof Specification) { - violations.add(null, "top level scope of the specification contains an initialization predicate"); - } else { - violations.add(comp, "component contains an initialization predicate"); - } + violations.add(comp, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" contains an initialization predicate")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java index e0eaede8a..be6bb1250 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java @@ -19,8 +19,9 @@ import java.util.Map; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; -import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryOperator; @@ -40,26 +41,14 @@ public class CompOnlyVarValueMarkerPredsCheck extends CifCheck { for (Expression marked: comp.getMarkeds()) { // The only supported form is 'discrete_variable = marked_value'. if (!(marked instanceof BinaryExpression)) { - if (comp instanceof Specification) { - violations.add(null, - "top level scope of the specification has a marker predicate that is not of the form " - + "\"discrete_variable = marked_value\""); - } else { - violations.add(comp, "component has a marker predicate that is not of the form " - + "\"discrete_variable = marked_value\""); - } + violations.add(comp, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( + " has a marker predicate that is not of the form \"discrete_variable = marked_value\"")); continue; } BinaryExpression bexpr = (BinaryExpression)marked; if (bexpr.getOperator() != BinaryOperator.EQUAL || !(bexpr.getLeft() instanceof DiscVariableExpression)) { - if (comp instanceof Specification) { - violations.add(null, - "top level scope of the specification has a marker predicate that is not of the form " - + "\"discrete_variable = marked_value\""); - } else { - violations.add(comp, "component has a marker predicate that is not of the form " - + "\"discrete_variable = marked_value\""); - } + violations.add(comp, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( + " has a marker predicate that is not of the form \"discrete_variable = marked_value\"")); continue; } @@ -71,7 +60,8 @@ public class CompOnlyVarValueMarkerPredsCheck extends CifCheck { if (previousValue == null) { markeds.put(var, newValue); } else { - violations.add(var, "discrete variable has multiple predicates to specify its marked values"); + violations.add(var, + new LiteralMessage("discrete variable has multiple predicates that specify its marked values")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java index 944a52462..bb80b7395 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java @@ -18,10 +18,11 @@ import static org.eclipse.escet.common.java.Strings.fmt; import org.eclipse.escet.cif.common.CifTextUtils; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; import org.eclipse.escet.cif.metamodel.cif.InvKind; import org.eclipse.escet.cif.metamodel.cif.Invariant; -import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.cif.metamodel.cif.SupKind; /** CIF check that allows state invariants in components only if they are requirement invariants. */ @@ -33,12 +34,8 @@ public class CompStateInvsOnlyReqsCheck extends CifCheck { SupKind supKind = inv.getSupKind(); if (supKind != SupKind.REQUIREMENT) { String kindTxt = (supKind == SupKind.NONE) ? "kindless" : CifTextUtils.kindToStr(supKind); - if (comp instanceof Specification) { - violations.add(null, - fmt("top level scope of the specification has a %s state invariant", kindTxt)); - } else { - violations.add(comp, fmt("component has a %s state invariant", kindTxt)); - } + violations.add(comp, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(fmt(" has a %s state invariant", kindTxt))); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java index 2eedaa4eb..d43e769d0 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java @@ -13,13 +13,11 @@ package org.eclipse.escet.cif.common.checkers.checks; -import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.IfUpdate; -import org.eclipse.escet.cif.metamodel.cif.automata.Location; -import org.eclipse.escet.common.java.Assert; /** * CIF check that does not allow 'if' updates on edges. @@ -29,19 +27,8 @@ import org.eclipse.escet.common.java.Assert; public class EdgeNoIfUpdatesCheck extends CifCheck { @Override protected void preprocessIfUpdate(IfUpdate update, CifCheckViolations violations) { - // Get location. - EObject ancestor = update; - while (!(ancestor instanceof Location)) { - ancestor = ancestor.eContainer(); - } - Assert.check(ancestor instanceof Location); - Location loc = (Location)ancestor; - - // Report violation. - if (loc.getName() != null) { - violations.add(loc, "location has an edge with an 'if' update"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has an edge with an 'if' update"); - } + // Report violation on the closest named ancestor of the 'if' update: a location or an automaton. + violations.add(update, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" has an edge with an 'if' update")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java index 532c55294..b5c2a9bd5 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java @@ -13,14 +13,12 @@ package org.eclipse.escet.cif.common.checkers.checks; -import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; -import org.eclipse.escet.cif.metamodel.cif.automata.Location; import org.eclipse.escet.cif.metamodel.cif.expressions.TupleExpression; -import org.eclipse.escet.common.java.Assert; /** * CIF check that does not allow multi-assignments on edges. This check does not disallow multiple assignments on a @@ -32,20 +30,9 @@ public class EdgeNoMultiAssignCheck extends CifCheck { @Override protected void preprocessAssignment(Assignment asgn, CifCheckViolations violations) { if (asgn.getAddressable() instanceof TupleExpression) { - // Get location. - EObject ancestor = asgn; - while (!(ancestor instanceof Location)) { - ancestor = ancestor.eContainer(); - } - Assert.check(ancestor instanceof Location); - Location loc = (Location)ancestor; - - // Report violation. - if (loc.getName() != null) { - violations.add(loc, "location has an edge with a multi-assignment"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has an edge with a multi-assignment"); - } + // Report violation on the closest named ancestor of the assignment: a location or an automaton. + violations.add(asgn, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" has an edge with a multi-assignment")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java index b2728f89b..5e0cc8ffe 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java @@ -13,14 +13,12 @@ package org.eclipse.escet.cif.common.checkers.checks; -import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; -import org.eclipse.escet.cif.metamodel.cif.automata.Location; import org.eclipse.escet.cif.metamodel.cif.expressions.ProjectionExpression; -import org.eclipse.escet.common.java.Assert; /** * CIF check that does not allow partial variable assignments on edges. @@ -31,20 +29,9 @@ public class EdgeNoPartialVarAssignCheck extends CifCheck { @Override protected void preprocessAssignment(Assignment asgn, CifCheckViolations violations) { if (asgn.getAddressable() instanceof ProjectionExpression) { - // Get location. - EObject ancestor = asgn; - while (!(ancestor instanceof Location)) { - ancestor = ancestor.eContainer(); - } - Assert.check(ancestor instanceof Location); - Location loc = (Location)ancestor; - - // Report violation. - if (loc.getName() != null) { - violations.add(loc, "location has an edge with a partial variable assignment"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has an edge with a partial variable assignment"); - } + // Report violation on the closest named ancestor of the assignment: a location or an automaton. + violations.add(asgn, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" has an edge with a partial variable assignment")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java index 7944e41d5..f21b827e7 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java @@ -15,21 +15,17 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Edge; -import org.eclipse.escet.cif.metamodel.cif.automata.Location; /** CIF check that does not allow urgent edges. */ public class EdgeNoUrgentCheck extends CifCheck { @Override protected void preprocessEdge(Edge edge, CifCheckViolations violations) { if (edge.isUrgent()) { - Location loc = (Location)edge.eContainer(); - if (loc.getName() != null) { - violations.add(loc, "location has an urgent edge"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has an urgent edge"); - } + // Report violation on the closest named ancestor of the edge: a location or an automaton. + violations.add(edge, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has an urgent edge")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java index c0e9c3087..e692fdc83 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java @@ -15,6 +15,8 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.declarations.Event; /** CIF check that does not allow channels. */ @@ -22,7 +24,8 @@ public class EventNoChannelsCheck extends CifCheck { @Override protected void preprocessEvent(Event event, CifCheckViolations violations) { if (event.getType() != null) { - violations.add(event, "event is a channel (has a data type)"); + violations.add(event, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" is a channel (has a data type)")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java index 1674be782..92dea8aa9 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java @@ -13,13 +13,11 @@ package org.eclipse.escet.cif.common.checkers.checks; -import org.eclipse.escet.cif.common.CifEdgeUtils; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Edge; -import org.eclipse.escet.cif.metamodel.cif.automata.EdgeEvent; -import org.eclipse.escet.cif.metamodel.cif.automata.Location; import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; /** @@ -31,27 +29,18 @@ public class EventNoTauCheck extends CifCheck { @Override protected void preprocessTauExpression(TauExpression tauExpr, CifCheckViolations violations) { // Explicit tau. - EdgeEvent edgeEvent = (EdgeEvent)tauExpr.eContainer(); - Edge edge = (Edge)edgeEvent.eContainer(); - Location loc = CifEdgeUtils.getSource(edge); - if (loc.getName() != null) { - violations.add(loc, "location has an edge with explicitly event \"tau\" on it"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has an edge with explicitly event \"tau\" on it"); - } + // Report violation on the closest named ancestor of the tau expression: a location or an automaton. + violations.add(tauExpr, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" has an edge with explicitly event \"tau\" on it")); } @Override protected void preprocessEdge(Edge edge, CifCheckViolations violations) { // Implicit tau. if (edge.getEvents().isEmpty()) { - Location loc = CifEdgeUtils.getSource(edge); - if (loc.getName() != null) { - violations.add(loc, "location has an edge with implicitly event \"tau\" on it"); - } else { - violations.add((Automaton)loc.eContainer(), - "automaton has an edge with implicitly event \"tau\" on it"); - } + // Report violation on the closest named ancestor of the edge: a location or an automaton. + violations.add(edge, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" has an edge with implicitly event \"tau\" on it")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java index 55dfe5d26..deb169639 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java @@ -13,13 +13,11 @@ package org.eclipse.escet.cif.common.checkers.checks; -import org.eclipse.escet.cif.common.CifEdgeUtils; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Edge; -import org.eclipse.escet.cif.metamodel.cif.automata.EdgeEvent; -import org.eclipse.escet.cif.metamodel.cif.automata.Location; import org.eclipse.escet.cif.metamodel.cif.declarations.Event; import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; @@ -32,37 +30,26 @@ public class EventOnlyWithControllabilityCheck extends CifCheck { @Override protected void preprocessEvent(Event event, CifCheckViolations violations) { if (event.getControllable() == null) { - violations.add(event, "event is not declared as controllable or uncontrollable"); + violations.add(event, new ReportObjectTypeDescriptionMessage(), + new LiteralMessage(" is not declared as controllable or uncontrollable")); } } @Override protected void preprocessTauExpression(TauExpression tauExpr, CifCheckViolations violations) { // Explicit tau. - EdgeEvent edgeEvent = (EdgeEvent)tauExpr.eContainer(); - Edge edge = (Edge)edgeEvent.eContainer(); - Location loc = CifEdgeUtils.getSource(edge); - if (loc.getName() != null) { - violations.add(loc, "location has an edge with explicitly event \"tau\" on it, " - + "which is not controllable or uncontrollable"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has an edge with explicitly event \"tau\" on it, " - + "which is not controllable or uncontrollable"); - } + // Report violation on the closest named ancestor of the tau expression: a location or an automaton. + violations.add(tauExpr, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( + " has an edge with explicitly event \"tau\" on it, which is not controllable or uncontrollable")); } @Override protected void preprocessEdge(Edge edge, CifCheckViolations violations) { // Implicit tau. if (edge.getEvents().isEmpty()) { - Location loc = CifEdgeUtils.getSource(edge); - if (loc.getName() != null) { - violations.add(loc, "location has an edge with implicitly event \"tau\" on it, " - + "which is not controllable or uncontrollable"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has an edge with implicitly event \"tau\" on " - + "it, which is not controllable or uncontrollable"); - } + // Report violation on the closest named ancestor of the edge: a location or an automaton. + violations.add(edge, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( + " has an edge with implicitly event \"tau\" on it, which is not controllable or uncontrollable")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificBinaryExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificBinaryExprsCheck.java index 1c0e5f4a8..a66394aef 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificBinaryExprsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificBinaryExprsCheck.java @@ -14,7 +14,6 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; -import static org.eclipse.escet.cif.common.CifTextUtils.getNamedSelfOrAncestor; import static org.eclipse.escet.cif.common.CifTextUtils.operatorToStr; import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; import static org.eclipse.escet.common.java.Strings.fmt; @@ -25,6 +24,7 @@ import java.util.EnumSet; import org.eclipse.escet.cif.common.CifTypeUtils; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryOperator; import org.eclipse.escet.cif.metamodel.cif.types.CifType; @@ -426,8 +426,8 @@ public class ExprNoSpecificBinaryExprsCheck extends CifCheck { * @param violations The violations collected so far. Is modified in-place. */ private void addExprViolationOperator(BinaryExpression binExpr, CifCheckViolations violations) { - violations.add(getNamedSelfOrAncestor(binExpr), fmt("uses binary operator \"%s\" in binary expression \"%s\"", - operatorToStr(binExpr.getOperator()), exprToStr(binExpr))); + violations.add(binExpr, new LiteralMessage(fmt("uses binary operator \"%s\" in binary expression \"%s\"", + operatorToStr(binExpr.getOperator()), exprToStr(binExpr)))); } /** @@ -439,9 +439,9 @@ public class ExprNoSpecificBinaryExprsCheck extends CifCheck { private void addExprViolationOperand(BinaryExpression binExpr, CifCheckViolations violations) { CifType ltype = CifTypeUtils.normalizeType(binExpr.getLeft().getType()); CifType rtype = CifTypeUtils.normalizeType(binExpr.getRight().getType()); - violations.add(getNamedSelfOrAncestor(binExpr), + violations.add(binExpr, new LiteralMessage( fmt("uses binary operator \"%s\" on operands of types \"%s\" and \"%s\" in binary expression \"%s\"", - operatorToStr(binExpr.getOperator()), typeToStr(ltype), typeToStr(rtype), exprToStr(binExpr))); + operatorToStr(binExpr.getOperator()), typeToStr(ltype), typeToStr(rtype), exprToStr(binExpr)))); } /** The binary operator, or binary operator operating on certain operand types, to disallow. */ diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificExprsCheck.java index 98277f506..dcd384f22 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificExprsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificExprsCheck.java @@ -14,7 +14,6 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; -import static org.eclipse.escet.cif.common.CifTextUtils.getNamedSelfOrAncestor; import static org.eclipse.escet.common.java.Strings.fmt; import java.util.Arrays; @@ -25,6 +24,7 @@ import org.eclipse.escet.cif.common.CifTypeUtils; import org.eclipse.escet.cif.common.RangeCompat; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; import org.eclipse.escet.cif.metamodel.cif.expressions.AlgVariableExpression; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; @@ -388,7 +388,7 @@ public class ExprNoSpecificExprsCheck extends CifCheck { * @param violations The violations collected so far. Is modified in-place. */ private void addExprViolation(Expression expr, String description, CifCheckViolations violations) { - violations.add(getNamedSelfOrAncestor(expr), fmt("uses %s \"%s\"", description, exprToStr(expr))); + violations.add(expr, new LiteralMessage(fmt("uses %s \"%s\"", description, exprToStr(expr)))); } /** The expression to disallow. */ diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificUnaryExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificUnaryExprsCheck.java index d65ea8a3a..ecdfc0e5e 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificUnaryExprsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificUnaryExprsCheck.java @@ -14,7 +14,6 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; -import static org.eclipse.escet.cif.common.CifTextUtils.getNamedSelfOrAncestor; import static org.eclipse.escet.cif.common.CifTextUtils.operatorToStr; import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; import static org.eclipse.escet.common.java.Strings.fmt; @@ -25,6 +24,7 @@ import java.util.EnumSet; import org.eclipse.escet.cif.common.CifTypeUtils; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryExpression; import org.eclipse.escet.cif.metamodel.cif.expressions.UnaryOperator; import org.eclipse.escet.cif.metamodel.cif.types.CifType; @@ -131,8 +131,8 @@ public class ExprNoSpecificUnaryExprsCheck extends CifCheck { * @param violations The violations collected so far. Is modified in-place. */ private void addExprViolationOperator(UnaryExpression unExpr, CifCheckViolations violations) { - violations.add(getNamedSelfOrAncestor(unExpr), fmt("uses unary operator \"%s\" in unary expression \"%s\"", - operatorToStr(unExpr.getOperator()), exprToStr(unExpr))); + violations.add(unExpr, new LiteralMessage(fmt("uses unary operator \"%s\" in unary expression \"%s\"", + operatorToStr(unExpr.getOperator()), exprToStr(unExpr)))); } /** @@ -143,9 +143,10 @@ public class ExprNoSpecificUnaryExprsCheck extends CifCheck { */ private void addExprViolationOperand(UnaryExpression unExpr, CifCheckViolations violations) { CifType ctype = CifTypeUtils.normalizeType(unExpr.getChild().getType()); - violations.add(getNamedSelfOrAncestor(unExpr), - fmt("uses unary operator \"%s\" on an operand of type \"%s\" in unary expression \"%s\"", - operatorToStr(unExpr.getOperator()), typeToStr(ctype), exprToStr(unExpr))); + violations.add(unExpr, + new LiteralMessage( + fmt("uses unary operator \"%s\" on an operand of type \"%s\" in unary expression \"%s\"", + operatorToStr(unExpr.getOperator()), typeToStr(ctype), exprToStr(unExpr)))); } /** The unary operator, or unary operator operating on certain operand types, to disallow. */ diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/FuncNoUserDefinedCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/FuncNoUserDefinedCheck.java index a59976225..51cae6cae 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/FuncNoUserDefinedCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/FuncNoUserDefinedCheck.java @@ -15,12 +15,13 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.metamodel.cif.functions.Function; /** CIF check that does not allow user-defined functions. */ public class FuncNoUserDefinedCheck extends CifCheck { @Override protected void preprocessFunction(Function func, CifCheckViolations violations) { - violations.add(func, "function is a user-defined function"); + violations.add(func, new LiteralMessage("function is a user-defined function")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java index ee6e27b63..fee41bead 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java @@ -15,50 +15,24 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; -import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; +import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.InvKind; import org.eclipse.escet.cif.metamodel.cif.Invariant; -import org.eclipse.escet.cif.metamodel.cif.Specification; import org.eclipse.escet.cif.metamodel.cif.SupKind; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; -import org.eclipse.escet.cif.metamodel.cif.automata.Location; /** CIF check that does not allow kindless state/event exclusion invariants (without a supervisory kind). */ public class InvNoKindlessStateEvtExclCheck extends CifCheck { @Override - protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { - for (Invariant inv: comp.getInvariants()) { - if (inv.getInvKind() == InvKind.EVENT_NEEDS || inv.getInvKind() == InvKind.EVENT_DISABLES) { - SupKind supKind = inv.getSupKind(); - if (supKind == SupKind.NONE) { - if (comp instanceof Specification) { - violations.add(null, - "top level scope of the specification has a kindless state/event exclusion invariant, " - + "lacking a supervisory kind"); - } else { - violations.add(comp, - "component has a kindless state/event exclusion invariant, lacking a supervisory kind"); - } - } - } - } - } - - @Override - protected void preprocessLocation(Location loc, CifCheckViolations violations) { - for (Invariant inv: loc.getInvariants()) { - if (inv.getInvKind() == InvKind.EVENT_NEEDS || inv.getInvKind() == InvKind.EVENT_DISABLES) { - SupKind supKind = inv.getSupKind(); - if (supKind == SupKind.NONE) { - if (loc.getName() != null) { - violations.add(loc, - "location has a kindless state/event exclusion invariant, lacking a supervisory kind"); - } else { - violations.add((Automaton)loc.eContainer(), - "automaton has a location with a kindless state/event exclusion invariant, " - + "lacking a supervisory kind"); - } - } + protected void preprocessInvariant(Invariant inv, CifCheckViolations violations) { + if (inv.getInvKind() == InvKind.EVENT_NEEDS || inv.getInvKind() == InvKind.EVENT_DISABLES) { + SupKind supKind = inv.getSupKind(); + if (supKind == SupKind.NONE) { + // The closest named ancestor of the invariant is the invariant itself, or a location or a component. + violations.add(inv, new ReportObjectTypeDescriptionMessage(), + new IfReportOnAncestorMessage(" has an invariant that"), new LiteralMessage( + " is a kindless state/event exclusion invariant, lacking a supervisory kind")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java index 9d4373763..24af02b6a 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java @@ -13,32 +13,27 @@ package org.eclipse.escet.cif.common.checkers.checks; -import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.InvKind; import org.eclipse.escet.cif.metamodel.cif.Invariant; -import org.eclipse.escet.cif.metamodel.cif.LocationParameter; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; import org.eclipse.escet.cif.metamodel.cif.automata.Location; /** CIF check that does not allow state invariants in locations. */ public class LocNoStateInvsCheck extends CifCheck { @Override protected void preprocessLocation(Location loc, CifCheckViolations violations) { - // Skip location parameters. - EObject parent = loc.eContainer(); - if (parent instanceof LocationParameter) { - return; - } - - // Check for violation. + // Note that location parameters never have invariants. for (Invariant inv: loc.getInvariants()) { if (inv.getInvKind() == InvKind.STATE) { if (loc.getName() != null) { - violations.add(loc, "location has a state invariant"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has a location with a state invariant"); + // Report violation on the location, or on its automaton in case the location has no name. + violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has"), + new IfReportOnAncestorMessage(" a location with"), + new LiteralMessage(" a state invariant")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java index 040c8f892..8d3642976 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java @@ -13,30 +13,22 @@ package org.eclipse.escet.cif.common.checkers.checks; -import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; -import org.eclipse.escet.cif.metamodel.cif.LocationParameter; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Location; /** CIF check that does not allow urgent locations. */ public class LocNoUrgentCheck extends CifCheck { @Override protected void preprocessLocation(Location loc, CifCheckViolations violations) { - // Skip location parameters. - EObject parent = loc.eContainer(); - if (parent instanceof LocationParameter) { - return; - } - - // Check for violation. + // Note that location parameters are never urgent. if (loc.isUrgent()) { - if (loc.getName() != null) { - violations.add(loc, "location is urgent"); - } else { - violations.add((Automaton)loc.eContainer(), "automaton has an urgent location"); - } + // Report violation on the location, or on its automaton in case the location has no name. + violations.add(loc, new ReportObjectTypeDescriptionMessage(), + new IfReportOnAncestorMessage(" has a location that"), new LiteralMessage(" is urgent")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java index c221a24e6..b53eb4977 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java @@ -15,12 +15,12 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifEvalUtils.evalPreds; -import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.CifEvalException; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; -import org.eclipse.escet.cif.metamodel.cif.LocationParameter; -import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; +import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Location; import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; @@ -28,31 +28,21 @@ import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; public class LocOnlyStaticEvalMarkerPredsCheck extends CifCheck { @Override protected void preprocessLocation(Location loc, CifCheckViolations violations) { - // Skip location parameters. - EObject parent = loc.eContainer(); - if (parent instanceof LocationParameter) { - return; - } - - // Check for violation. + // Note that location parameters never have marker predicates. if (!loc.getMarkeds().isEmpty()) { try { evalPreds(loc.getMarkeds(), false, true); } catch (UnsupportedException e) { - if (loc.getName() != null) { - violations.add(loc, "location has a marker predicate that can not be evaluated statically"); - } else { - violations.add((Automaton)loc.eContainer(), - "automaton has a location with a marker predicate that can not be evaluated statically"); - } + // Report violation on the location, or on its automaton in case the location has no name. + violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has"), + new IfReportOnAncestorMessage(" a location with"), + new LiteralMessage(" a marker predicate that can not be evaluated statically")); } catch (CifEvalException e) { - if (loc.getName() != null) { - violations.add(loc, - "static evaluation of a marker predicate in the location resulted in an evaluation error"); - } else { - violations.add((Automaton)loc.eContainer(), "static evaluation of a marker predicate in the " - + "location of the automaton resulted in an evaluation error"); - } + // Report violation on the location, or on its automaton in case the location has no name. + violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has"), + new IfReportOnAncestorMessage(" a location with"), + new LiteralMessage(" a marker predicate that can not be evaluated statically, " + + "as the evaluation resulted in an evaluation error")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/TypeNoSpecificTypesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/TypeNoSpecificTypesCheck.java index fab1da6dc..0fa13c3b6 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/TypeNoSpecificTypesCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/TypeNoSpecificTypesCheck.java @@ -13,7 +13,6 @@ package org.eclipse.escet.cif.common.checkers.checks; -import static org.eclipse.escet.cif.common.CifTextUtils.getNamedSelfOrAncestor; import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; import static org.eclipse.escet.common.java.Strings.fmt; @@ -23,6 +22,7 @@ import java.util.EnumSet; import org.eclipse.escet.cif.common.CifTypeUtils; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.metamodel.cif.types.CifType; import org.eclipse.escet.cif.metamodel.cif.types.ComponentDefType; import org.eclipse.escet.cif.metamodel.cif.types.ComponentType; @@ -164,7 +164,7 @@ public class TypeNoSpecificTypesCheck extends CifCheck { * @param violations The violations collected so far. Is modified in-place. */ private void addTypeViolation(CifType type, String description, CifCheckViolations violations) { - violations.add(getNamedSelfOrAncestor(type), fmt("uses %s \"%s\"", description, typeToStr(type))); + violations.add(type, new LiteralMessage(fmt("uses %s \"%s\"", description, typeToStr(type)))); } /** The type, or sub-type, to disallow. */ diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoContinuousCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoContinuousCheck.java index bb1e343b1..cb2a51f20 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoContinuousCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoContinuousCheck.java @@ -15,12 +15,13 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.metamodel.cif.declarations.ContVariable; /** CIF check that does not allow continuous variables. */ public class VarNoContinuousCheck extends CifCheck { @Override protected void preprocessContVariable(ContVariable var, CifCheckViolations violations) { - violations.add(var, "variable is a continuous variable"); + violations.add(var, new LiteralMessage("variable is a continuous variable")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java index 839580cba..9fe37bb08 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java @@ -18,6 +18,7 @@ import static org.eclipse.escet.common.java.Strings.fmt; import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; @@ -31,7 +32,7 @@ public class VarNoDiscWithMultiInitValuesCheck extends CifCheck { return; } - // Ignore variables implicit default value. + // Ignore variables with implicit default value. if (var.getValue() == null) { return; } @@ -39,9 +40,11 @@ public class VarNoDiscWithMultiInitValuesCheck extends CifCheck { // Check number of potential initial values. int count = var.getValue().getValues().size(); if (count == 0) { // 0 means 'any' initial value. - violations.add(var, "discrete variable has multiple potential initial values (any value in its domain)"); + violations.add(var, new LiteralMessage( + "discrete variable has multiple potential initial values (any value in its domain)")); } else if (count > 1) { - violations.add(var, fmt("discrete variable has multiple (%d) potential initial values", count)); + violations.add(var, + new LiteralMessage(fmt("discrete variable has multiple (%d) potential initial values", count))); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoInputCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoInputCheck.java index b67e71fed..d22903a34 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoInputCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoInputCheck.java @@ -15,12 +15,13 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; +import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.metamodel.cif.declarations.InputVariable; /** CIF check that does not allow input variables. */ public class VarNoInputCheck extends CifCheck { @Override protected void preprocessInputVariable(InputVariable var, CifCheckViolations violations) { - violations.add(var, "variable is an input variable"); + violations.add(var, new LiteralMessage("variable is an input variable")); } } -- GitLab From 772f6a4b9c4543fe6e2f66a68120f67d60b8b1da Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 11 Sep 2022 19:43:47 +0200 Subject: [PATCH 13/51] #398 Update CIF to Supremica tests for precondition check changes. --- .../invalid1.cif.cif2supremica.err | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err index a55a5b5a7..260518706 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err @@ -1,11 +1,11 @@ WARNING: File "cif2supremica/invalid1.cif": Semantic warning at line 31, column 9: Automaton "g.p0" has no initial location. ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - - Unsupported "g": component contains an initialization predicate. - - Unsupported "g": component has a kindless state invariant. - - Unsupported "g": component has a kindless state/event exclusion invariant, lacking a supervisory kind. - - Unsupported "g": component has a marker predicate that is not of the form "discrete_variable = marked_value". - - Unsupported "g": component has a plant state invariant. - - Unsupported "g": component has a supervisor state invariant. + - Unsupported "g": group contains an initialization predicate. + - Unsupported "g": group has a kindless state invariant. + - Unsupported "g": group has a marker predicate that is not of the form "discrete_variable = marked_value". + - Unsupported "g": group has a plant state invariant. + - Unsupported "g": group has a supervisor state invariant. + - Unsupported "g": group has an invariant that is a kindless state/event exclusion invariant, lacking a supervisory kind. - Unsupported "g": uses list literal "[false, true]". - Unsupported "g": uses list literal "[false]". - Unsupported "g": uses list literal "[true]". @@ -20,10 +20,10 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g.e1": event is not declared as controllable or uncontrollable. - Unsupported "g.e2": event is a channel (has a data type). - Unsupported "g.f": function is a user-defined function. + - Unsupported "g.p0": automaton has a location that is urgent. - Unsupported "g.p0": automaton has an edge with a multi-assignment. - Unsupported "g.p0": automaton has an edge with a partial variable assignment. - Unsupported "g.p0": automaton has an edge with an 'if' update. - - Unsupported "g.p0": automaton has an urgent location. - Unsupported "g.p0": automaton has no initial location. - Unsupported "g.p0": uses list type "list bool". - Unsupported "g.p0": uses projection expression "g.p0.lb[0]". @@ -35,16 +35,15 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g.p0.cnt": uses real type "real". - Unsupported "g.p0.cnt": variable is a continuous variable. - Unsupported "g.p0.inp": variable is an input variable. - - Unsupported "g.p0.lb": discrete variable has multiple predicates to specify its marked values. + - Unsupported "g.p0.lb": discrete variable has multiple predicates that specify its marked values. - Unsupported "g.p0.lb": uses list literal "[true]". - Unsupported "g.p0.lb": uses list type "list bool". - Unsupported "g.p0.lb": uses list type "list[1] bool". - Unsupported "g.p0.x1": discrete variable has multiple (2) potential initial values. - - Unsupported "g.p0.x1": discrete variable has multiple predicates to specify its marked values. + - Unsupported "g.p0.x1": discrete variable has multiple predicates that specify its marked values. - Unsupported "g.p0.x2": discrete variable has multiple potential initial values (any value in its domain). - - Unsupported "g.p1": automaton has a location with a state invariant. + - Unsupported "g.p1": automaton has a location with a marker predicate that can not be evaluated statically, as the evaluation resulted in an evaluation error. - Unsupported "g.p1": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. - - Unsupported "g.p1": static evaluation of a marker predicate in the location of the automaton resulted in an evaluation error. - Unsupported "g.p1": uses binary operator ">" on operands of types "real" and "int[0..0]" in binary expression "sqrt(-1.0) > 0". - Unsupported "g.p1": uses binary operator ">" on operands of types "real" and "int[0..0]" in binary expression "sqrt(-2.0) > 0". - Unsupported "g.p1": uses function call "sqrt(-1.0)". @@ -55,9 +54,9 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g.p1": uses real type "real". - Unsupported "g.p1": uses unary operator "-" on an operand of type "real" in unary expression "-1.0". - Unsupported "g.p1": uses unary operator "-" on an operand of type "real" in unary expression "-2.0". - - Unsupported "g.p2": automata has multiple (2) initial locations. + - Unsupported "g.p2": automaton has multiple (2) initial locations. - Unsupported "g.snd": automaton has an urgent edge. - - Unsupported specification: top level scope of the specification contains an initialization predicate. - - Unsupported specification: top level scope of the specification has a kindless state invariant. - - Unsupported specification: top level scope of the specification has a kindless state/event exclusion invariant, lacking a supervisory kind. - - Unsupported specification: top level scope of the specification has a marker predicate that is not of the form "discrete_variable = marked_value". + - Unsupported specification: the top level scope of the specification contains an initialization predicate. + - Unsupported specification: the top level scope of the specification has a kindless state invariant. + - Unsupported specification: the top level scope of the specification has a marker predicate that is not of the form "discrete_variable = marked_value". + - Unsupported specification: the top level scope of the specification has an invariant that is a kindless state/event exclusion invariant, lacking a supervisory kind. -- GitLab From bb0a16462a3ec82d5f20ecfb213cacfd470a007f Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 11 Sep 2022 19:47:11 +0200 Subject: [PATCH 14/51] #398 Fix check regression + improve violation messages. --- .../checkers/checks/InvNoKindlessStateEvtExclCheck.java | 7 ++++--- .../cif/common/checkers/checks/LocNoStateInvsCheck.java | 9 +++------ .../cif/common/checkers/checks/LocNoUrgentCheck.java | 4 ++-- .../tests/cif2supremica/invalid1.cif.cif2supremica.err | 7 ++++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java index fee41bead..453f8dc18 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java @@ -16,6 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; +import org.eclipse.escet.cif.common.checkers.messages.IfReportOnSelfMessage; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.InvKind; @@ -30,9 +31,9 @@ public class InvNoKindlessStateEvtExclCheck extends CifCheck { SupKind supKind = inv.getSupKind(); if (supKind == SupKind.NONE) { // The closest named ancestor of the invariant is the invariant itself, or a location or a component. - violations.add(inv, new ReportObjectTypeDescriptionMessage(), - new IfReportOnAncestorMessage(" has an invariant that"), new LiteralMessage( - " is a kindless state/event exclusion invariant, lacking a supervisory kind")); + violations.add(inv, new ReportObjectTypeDescriptionMessage(), new IfReportOnAncestorMessage(" has"), + new IfReportOnSelfMessage(" is"), + new LiteralMessage(" a kindless state/event exclusion invariant, lacking a supervisory kind")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java index 24af02b6a..457afad57 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java @@ -29,12 +29,9 @@ public class LocNoStateInvsCheck extends CifCheck { // Note that location parameters never have invariants. for (Invariant inv: loc.getInvariants()) { if (inv.getInvKind() == InvKind.STATE) { - if (loc.getName() != null) { - // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has"), - new IfReportOnAncestorMessage(" a location with"), - new LiteralMessage(" a state invariant")); - } + // Report violation on the location, or on its automaton in case the location has no name. + violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has"), + new IfReportOnAncestorMessage(" a location with"), new LiteralMessage(" a state invariant")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java index 8d3642976..a8ecba3b5 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; -import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; +import org.eclipse.escet.cif.common.checkers.messages.IfReportOnSelfMessage; import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Location; @@ -28,7 +28,7 @@ public class LocNoUrgentCheck extends CifCheck { if (loc.isUrgent()) { // Report violation on the location, or on its automaton in case the location has no name. violations.add(loc, new ReportObjectTypeDescriptionMessage(), - new IfReportOnAncestorMessage(" has a location that"), new LiteralMessage(" is urgent")); + new IfReportOnAncestorMessage(" has an urgent location"), new IfReportOnSelfMessage(" is urgent")); } } } diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err index 260518706..e74b249b3 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err @@ -2,10 +2,10 @@ WARNING: File "cif2supremica/invalid1.cif": Semantic warning at line 31, column ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g": group contains an initialization predicate. - Unsupported "g": group has a kindless state invariant. + - Unsupported "g": group has a kindless state/event exclusion invariant, lacking a supervisory kind. - Unsupported "g": group has a marker predicate that is not of the form "discrete_variable = marked_value". - Unsupported "g": group has a plant state invariant. - Unsupported "g": group has a supervisor state invariant. - - Unsupported "g": group has an invariant that is a kindless state/event exclusion invariant, lacking a supervisory kind. - Unsupported "g": uses list literal "[false, true]". - Unsupported "g": uses list literal "[false]". - Unsupported "g": uses list literal "[true]". @@ -20,10 +20,10 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g.e1": event is not declared as controllable or uncontrollable. - Unsupported "g.e2": event is a channel (has a data type). - Unsupported "g.f": function is a user-defined function. - - Unsupported "g.p0": automaton has a location that is urgent. - Unsupported "g.p0": automaton has an edge with a multi-assignment. - Unsupported "g.p0": automaton has an edge with a partial variable assignment. - Unsupported "g.p0": automaton has an edge with an 'if' update. + - Unsupported "g.p0": automaton has an urgent location. - Unsupported "g.p0": automaton has no initial location. - Unsupported "g.p0": uses list type "list bool". - Unsupported "g.p0": uses projection expression "g.p0.lb[0]". @@ -43,6 +43,7 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g.p0.x1": discrete variable has multiple predicates that specify its marked values. - Unsupported "g.p0.x2": discrete variable has multiple potential initial values (any value in its domain). - Unsupported "g.p1": automaton has a location with a marker predicate that can not be evaluated statically, as the evaluation resulted in an evaluation error. + - Unsupported "g.p1": automaton has a location with a state invariant. - Unsupported "g.p1": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. - Unsupported "g.p1": uses binary operator ">" on operands of types "real" and "int[0..0]" in binary expression "sqrt(-1.0) > 0". - Unsupported "g.p1": uses binary operator ">" on operands of types "real" and "int[0..0]" in binary expression "sqrt(-2.0) > 0". @@ -58,5 +59,5 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g.snd": automaton has an urgent edge. - Unsupported specification: the top level scope of the specification contains an initialization predicate. - Unsupported specification: the top level scope of the specification has a kindless state invariant. + - Unsupported specification: the top level scope of the specification has a kindless state/event exclusion invariant, lacking a supervisory kind. - Unsupported specification: the top level scope of the specification has a marker predicate that is not of the form "discrete_variable = marked_value". - - Unsupported specification: the top level scope of the specification has an invariant that is a kindless state/event exclusion invariant, lacking a supervisory kind. -- GitLab From 3abcc021a95916375e2c777cb951eebe1e7859b0 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 11 Sep 2022 21:57:39 +0200 Subject: [PATCH 15/51] #416 Add CIF common checks integration test app/scripts/etc. --- .../META-INF/MANIFEST.MF | 9 +- .../escet/cif/tests/CifChecksTestApp.java | 152 ++++++++++++++++++ .../org/eclipse/escet/cif/tests/CifTest.java | 6 + .../tests/test_all.tooldef | 1 + .../tests/test_checks.tooldef | 98 +++++++++++ 5 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifChecksTestApp.java create mode 100644 cif/org.eclipse.escet.cif.tests/tests/test_checks.tooldef diff --git a/cif/org.eclipse.escet.cif.tests/META-INF/MANIFEST.MF b/cif/org.eclipse.escet.cif.tests/META-INF/MANIFEST.MF index 16aa4e08b..8ad322af3 100644 --- a/cif/org.eclipse.escet.cif.tests/META-INF/MANIFEST.MF +++ b/cif/org.eclipse.escet.cif.tests/META-INF/MANIFEST.MF @@ -26,6 +26,13 @@ Require-Bundle: org.junit;bundle-version="4.12.0", org.eclipse.escet.cif.simulator;bundle-version="0.7.0", org.eclipse.escet.cif.cif2cif.app;bundle-version="0.7.0", org.eclipse.escet.common.java;bundle-version="0.7.0", - org.eclipse.escet.cif.controllercheck;bundle-version="0.2.0" + org.eclipse.escet.cif.controllercheck;bundle-version="0.7.0", + org.eclipse.escet.cif.io;bundle-version="0.7.0", + org.eclipse.escet.cif.metamodel;bundle-version="0.7.0", + org.eclipse.escet.setext.runtime;bundle-version="0.7.0", + org.eclipse.escet.cif.parser;bundle-version="0.7.0", + org.eclipse.escet.common.typechecker;bundle-version="0.7.0", + org.eclipse.escet.cif.common;bundle-version="0.7.0", + org.eclipse.escet.cif.metamodel.java;bundle-version="0.7.0" Export-Package: org.eclipse.escet.cif.tests Automatic-Module-Name: org.eclipse.escet.cif.tests diff --git a/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifChecksTestApp.java b/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifChecksTestApp.java new file mode 100644 index 000000000..0302614aa --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifChecksTestApp.java @@ -0,0 +1,152 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.cif.tests; + +import static org.eclipse.escet.common.java.Lists.list; +import static org.eclipse.escet.common.java.Strings.fmt; + +import java.util.List; + +import org.eclipse.escet.cif.common.CifPreconditionChecker; +import org.eclipse.escet.cif.common.checkers.CifCheck; +import org.eclipse.escet.cif.io.CifReader; +import org.eclipse.escet.cif.metamodel.cif.Specification; +import org.eclipse.escet.common.app.framework.Application; +import org.eclipse.escet.common.app.framework.io.AppStreams; +import org.eclipse.escet.common.app.framework.options.InputFileOption; +import org.eclipse.escet.common.app.framework.options.OptionCategory; +import org.eclipse.escet.common.app.framework.options.Options; +import org.eclipse.escet.common.app.framework.options.StringOption; +import org.eclipse.escet.common.app.framework.output.IOutputComponent; +import org.eclipse.escet.common.app.framework.output.OutputProvider; + +/** CIF checks test application. */ +public class CifChecksTestApp extends Application { + /** + * Constructor for the {@link CifChecksTestApp} class. + * + * @param streams The streams to use for input, output, and error streams. + */ + public CifChecksTestApp(AppStreams streams) { + super(streams); + } + + @Override + public String getAppName() { + return "CIF checks tester"; + } + + @Override + public String getAppDescription() { + return "Tests checks on CIF specification."; + } + + @Override + protected int runInternal() { + // Read CIF specification. + CifReader cifReader = new CifReader().init(); + Specification spec = cifReader.read(); + if (isTerminationRequested()) { + return 0; + } + + // Add configured check. + List checks = list(); + String checkClassNameToTest = CifCheckClassNameToTestOption.getCheckClassNameToTest(); + checkClassNameToTest = CifCheck.class.getPackageName() + ".checks." + checkClassNameToTest; + Class cls; + try { + cls = getClass().getClassLoader().loadClass(checkClassNameToTest); + } catch (ClassNotFoundException e) { + throw new RuntimeException(fmt("Failed to load class \"%s\".", checkClassNameToTest)); + } + CifCheck check; + try { + check = (CifCheck)cls.getDeclaredConstructor().newInstance(); + } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { + throw new RuntimeException(fmt("Failed to instantiate class \"%s\".", checkClassNameToTest)); + } + checks.add(check); + + // Perform check. + new CifPreconditionChecker(checks).reportPreconditionViolations(spec, "CIF checks tester"); + + // All done. + return 0; + } + + @Override + protected OutputProvider getProvider() { + return new OutputProvider<>(); + } + + @Override + protected OptionCategory getAllOptions() { + OptionCategory generalOpts = getGeneralOptionCategory(); + + OptionCategory transOpts = new OptionCategory("Checks", "Check options.", list(), list( + Options.getInstance(InputFileOption.class), Options.getInstance(CifCheckClassNameToTestOption.class))); + + OptionCategory options = new OptionCategory("CIF Checks Tester Options", + "All options for the CIF checks tester.", list(generalOpts, transOpts), list()); + + return options; + } + + /** CIF check class name option. */ + public static class CifCheckClassNameToTestOption extends StringOption { + /** Constructor for the {@link CifCheckClassNameToTestOption} class. */ + public CifCheckClassNameToTestOption() { + super( + // name + "Check", + + // description + "Specify the name of the check class to test.", + + // cmdShort + null, + + // cmdLong + "check-class-name", + + // cmdValue + "NAME", + + // defaultValue + null, + + // emptyAsNull + true, + + // showInDialog + false, + + // optDialogDescr + null, + + // optDialogLabelText + null); + } + + /** + * Returns the name of the check class to test. + * + * @return The name of the check class to test. + */ + public static String getCheckClassNameToTest() { + return Options.get(CifCheckClassNameToTestOption.class); + } + } +} diff --git a/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifTest.java b/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifTest.java index be3dbe260..fe7205ff1 100644 --- a/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifTest.java +++ b/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifTest.java @@ -24,6 +24,12 @@ public class CifTest extends ToolDefBasedPluginUnitTest { test("tests/test_tchecker.tooldef"); } + /** Checks tests. */ + @Test + public void testCifChecks() { + test("tests/test_checks.tooldef"); + } + /** Pretty print and elimination of component definition/instantiation tests. */ @Test public void testPprintElimCdef() { diff --git a/cif/org.eclipse.escet.cif.tests/tests/test_all.tooldef b/cif/org.eclipse.escet.cif.tests/tests/test_all.tooldef index f77d9c515..cfea05430 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/test_all.tooldef +++ b/cif/org.eclipse.escet.cif.tests/tests/test_all.tooldef @@ -13,6 +13,7 @@ int failures; failures = failures + tooldef("test_tchecker.tooldef", ignoreNonZeroExitCode=true); +failures = failures + tooldef("test_checks.tooldef", ignoreNonZeroExitCode=true); failures = failures + tooldef("test_pprint_elim_cdef.tooldef", ignoreNonZeroExitCode=true); failures = failures + tooldef("test_cif2cif.tooldef", ignoreNonZeroExitCode=true); diff --git a/cif/org.eclipse.escet.cif.tests/tests/test_checks.tooldef b/cif/org.eclipse.escet.cif.tests/tests/test_checks.tooldef new file mode 100644 index 000000000..6bc77a097 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/test_checks.tooldef @@ -0,0 +1,98 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2010, 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +tool int check(list string args = [], string stdin = "-", string stdout = "-", string stderr = "-", + bool appendOut = false, bool appendErr = false, bool errToOut = false, + bool ignoreNonZeroExitCode = false): + return app("org.eclipse.escet.cif.tests", "org.eclipse.escet.cif.tests.CifChecksTestApp", args, stdin, stdout, + stderr, appendOut, appendErr, errToOut, ignoreNonZeroExitCode); +end + + +// Configuration. +string test_path = "checks"; +string test_pattern = "*.cif"; +list string default_options = ["--devmode=1"]; +map(string:list string) test_options = {}; +set string test_skip = {}; + +// Initialize counts. +int count = 0; +int successes = 0; +int failures = 0; +int skipped = 0; + +// Find tests. +list string tests = find(test_path, test_pattern); +for i in range(tests):: tests[i] = replace(pathjoin(test_path, tests[i]), "\\", "/"); +for i in reverse(range(tests)): + if contains(test_skip, tests[i]): + tests = delidx(tests, i); + count = count + 1; + skipped = skipped + 1; + end +end + +// Test all tests. +for test in tests: + // Get test specific options. + list string options = default_options; + list string extra_options; + if contains(test_options, test):: extra_options = test_options[test]; + options = options + extra_options + ["--check-class-name=" + chfileext(basename(test), "cif")]; + + // Print what we are testing. + outln("Testing \"%s\" using options \"%s\"...", test, join(extra_options, " ")); + + // Get paths. + string test_out_exp = chfileext(test, newext="check.out"); + string test_err_exp = chfileext(test, newext="check.err"); + string test_out_real = chfileext(test, newext="check.out.real"); + string test_err_real = chfileext(test, newext="check.err.real"); + + // Execute. + check([test] + options, stdout=test_out_real, stderr=test_err_real, ignoreNonZeroExitCode=true); + + // Compare stdout/stderr. + bool stderr_diff = diff(test_err_exp, test_err_real, missingAsEmpty=true, warnOnDiff=true); + bool stdout_diff = diff(test_out_exp, test_out_real, missingAsEmpty=true, warnOnDiff=true); + if not stderr_diff:: rmfile(test_err_real); + if not stdout_diff:: rmfile(test_out_real); + + // Update counts. + int diff_count = 0; + if stderr_diff:: diff_count = diff_count + 1; + if stdout_diff:: diff_count = diff_count + 1; + + count = count + 1; + if diff_count == 0:: successes = successes + 1; + if diff_count > 0:: failures = failures + 1; +end + +// Get result message. +string rslt; +if failures == 0: rslt = "SUCCESS"; else rslt = "FAILURE"; end + +string msg = fmt("Test %s (%s): %d tests, %d successes, %d failures, %d skipped.", + rslt, test_path, count, successes, failures, skipped); + +// Output result message. +if failures == 0: + outln(msg); +else + errln(msg); +end + +// Return number of failures as exit code. No failures means zero exit code, +// any failures means non-zero exit code. +exit failures; -- GitLab From 3f63b81f89c34a55793c1204b9c893546178d590 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 11 Sep 2022 21:57:53 +0200 Subject: [PATCH 16/51] #416 Add CIF common check tests. --- .../tests/checks/AutNoKindlessCheck.cif | 94 +++++++++++ .../checks/AutNoKindlessCheck.cif.check.err | 5 + .../checks/AutOnlyWithOneInitLocCheck.cif | 151 ++++++++++++++++++ .../AutOnlyWithOneInitLocCheck.cif.check.err | 29 ++++ .../tests/checks/CompNoInitPredsCheck.cif | 35 ++++ .../checks/CompNoInitPredsCheck.cif.check.err | 6 + .../CompOnlyVarValueMarkerPredsCheck.cif | 98 ++++++++++++ ...OnlyVarValueMarkerPredsCheck.cif.check.err | 9 ++ .../checks/CompStateInvsOnlyReqsCheck.cif | 87 ++++++++++ .../CompStateInvsOnlyReqsCheck.cif.check.err | 9 ++ .../tests/checks/EdgeNoIfUpdatesCheck.cif | 94 +++++++++++ .../checks/EdgeNoIfUpdatesCheck.cif.check.err | 5 + .../tests/checks/EdgeNoMultiAssignCheck.cif | 95 +++++++++++ .../EdgeNoMultiAssignCheck.cif.check.err | 5 + .../checks/EdgeNoPartialVarAssignCheck.cif | 95 +++++++++++ .../EdgeNoPartialVarAssignCheck.cif.check.err | 5 + .../tests/checks/EdgeNoUrgentCheck.cif | 40 +++++ .../checks/EdgeNoUrgentCheck.cif.check.err | 5 + .../checks/EdgeOnlySimpleAssignmentsCheck.cif | 95 +++++++++++ ...geOnlySimpleAssignmentsCheck.cif.check.err | 13 ++ 20 files changed, 975 insertions(+) create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif new file mode 100644 index 000000000..8495aa537 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif @@ -0,0 +1,94 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +automaton a1: + location: + initial; +end + +plant p1: + location: + initial; +end + +requirement r1: + location: + initial; +end + +supervisor s1: + location: + initial; +end + +automaton def A1(): + location: + initial; +end + +plant def P1(): + location: + initial; +end + +requirement def R1(): + location: + initial; +end + +supervisor def S1(): + location: + initial; +end + +group g: + automaton a1: + location: + initial; + end + + plant p1: + location: + initial; + end + + requirement r1: + location: + initial; + end + + supervisor s1: + location: + initial; + end + + automaton def A1(): + location: + initial; + end + + plant def P1(): + location: + initial; + end + + requirement def R1(): + location: + initial; + end + + supervisor def S1(): + location: + initial; + end +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif.check.err new file mode 100644 index 000000000..144b2ead4 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif.check.err @@ -0,0 +1,5 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "A1": automaton definition is a kindless automaton, lacking a supervisory kind. + - Unsupported "a1": automaton is a kindless automaton, lacking a supervisory kind. + - Unsupported "g.A1": automaton definition is a kindless automaton, lacking a supervisory kind. + - Unsupported "g.a1": automaton is a kindless automaton, lacking a supervisory kind. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif new file mode 100644 index 000000000..c63cea26c --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif @@ -0,0 +1,151 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +event e; + +func int zero(): + return 0; +end + +group auts: + automaton one_init_loc: + location l1: + initial; + edge e goto l2; + location l2: + edge e goto l3; + location l3; + end + + automaton no_init_loc: + location l1: + initial false; + edge e goto l2; + location l2: + edge e goto l3; + location l3: + initial 1 = 2; + end + + automaton two_init_loc: + location l1: + initial; + edge e goto l2; + location l2: + initial true; + edge e goto l3; + location l3; + end + + automaton three_init_loc: + location l1: + initial; + edge e goto l2; + location l2: + initial true; + edge e goto l3; + location l3: + initial 1 = 1; + end + + automaton init_pred_non_static_eval_report_on_loc: + location loc: + initial zero() = 0; + end + + automaton init_pred_non_static_eval_report_on_aut: + location: + initial zero() = 0; + end + + automaton init_pred_eval_error_report_on_loc: + location loc: + initial 1 / 0 = 0; + end + + automaton init_pred_eval_error_report_on_aut: + location: + initial 1 / 0 = 0; + end +end + +group autdefs: + automaton def one_init_loc(): + location l1: + initial; + edge e goto l2; + location l2: + edge e goto l3; + location l3; + end + + automaton def no_init_loc(): + location l1: + initial false; + edge e goto l2; + location l2: + edge e goto l3; + location l3: + initial 1 = 2; + end + + automaton def two_init_loc(): + location l1: + initial; + edge e goto l2; + location l2: + initial true; + edge e goto l3; + location l3; + end + + automaton def three_init_loc(): + location l1: + initial; + edge e goto l2; + location l2: + initial true; + edge e goto l3; + location l3: + initial 1 = 1; + end + + automaton def init_pred_non_static_eval_report_on_loc(): + location loc: + initial zero() = 0; + end + + automaton def init_pred_non_static_eval_report_on_aut(): + location: + initial zero() = 0; + end + + automaton def init_pred_eval_error_report_on_loc(): + location loc: + initial 1 / 0 = 0; + end + + automaton def init_pred_eval_error_report_on_aut(): + location: + initial 1 / 0 = 0; + end +end + +automaton def loc_params_one_initial(location a, b): + location: + initial; +end + +automaton def loc_params_no_initial(location a, b): + location; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif.check.err new file mode 100644 index 000000000..e91c4db9b --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif.check.err @@ -0,0 +1,29 @@ +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 30, column 13: Automaton "auts.no_init_loc" has no initial location. +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 31, column 14: Location "l1" is not reachable from any of the initial locations of automaton "auts.no_init_loc". +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 34, column 14: Location "l2" is not reachable from any of the initial locations of automaton "auts.no_init_loc". +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 36, column 14: Location "l3" is not reachable from any of the initial locations of automaton "auts.no_init_loc". +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 92, column 17: Automaton "autdefs.no_init_loc" has no initial location. +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 93, column 14: Location "l1" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 96, column 14: Location "l2" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 98, column 14: Location "l3" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 144, column 47: Location parameter "loc_params_one_initial.a" is not used anywhere in the specification. +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 144, column 50: Location parameter "loc_params_one_initial.b" is not used anywhere in the specification. +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 15: Automaton "loc_params_no_initial" has no initial location. +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 46: Location parameter "loc_params_no_initial.a" is not used anywhere in the specification. +WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 49: Location parameter "loc_params_no_initial.b" is not used anywhere in the specification. +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "autdefs.init_pred_eval_error_report_on_aut": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "autdefs.init_pred_eval_error_report_on_loc.loc": failed to determine whether the location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "autdefs.init_pred_non_static_eval_report_on_aut": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "autdefs.init_pred_non_static_eval_report_on_loc.loc": failed to determine whether the location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "autdefs.no_init_loc": automaton definition has no initial location. + - Unsupported "autdefs.three_init_loc": automaton definition has multiple (3) initial locations. + - Unsupported "autdefs.two_init_loc": automaton definition has multiple (2) initial locations. + - Unsupported "auts.init_pred_eval_error_report_on_aut": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "auts.init_pred_eval_error_report_on_loc.loc": failed to determine whether the location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "auts.init_pred_non_static_eval_report_on_aut": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "auts.init_pred_non_static_eval_report_on_loc.loc": failed to determine whether the location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "auts.no_init_loc": automaton has no initial location. + - Unsupported "auts.three_init_loc": automaton has multiple (3) initial locations. + - Unsupported "auts.two_init_loc": automaton has multiple (2) initial locations. + - Unsupported "loc_params_no_initial": automaton definition has no initial location. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif new file mode 100644 index 000000000..053ed38f1 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif @@ -0,0 +1,35 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +initial 1 = 1; + +group g: + initial 2 = 2; + initial 3 = 3; + + automaton a: + initial 4 = 4; + location: + initial; + end + + automaton def A(): + initial 4 = 4; + location: + initial 5 = 5; + end + + group def G(): + initial 6 = 6; + end +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif.check.err new file mode 100644 index 000000000..ae40cf8ae --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif.check.err @@ -0,0 +1,6 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "g": group contains an initialization predicate. + - Unsupported "g.a": automaton contains an initialization predicate. + - Unsupported "g.A": automaton definition contains an initialization predicate. + - Unsupported "g.G": group definition contains an initialization predicate. + - Unsupported specification: the top level scope of the specification contains an initialization predicate. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif new file mode 100644 index 000000000..cff8d8b60 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif @@ -0,0 +1,98 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +automaton ok_marker: + disc bool v in any; + marked v = true; + location: + initial; +end + +automaton double_marker_in_aut: + disc bool v in any; + marked v = true; + marked v = false; + location: + initial; +end + +group double_marker_grp: + automaton double_marker_in_aut_and_grp: + disc bool v in any; + marked v = true; + location: + initial; + end + marked double_marker_in_aut_and_grp.v = false; +end + +automaton double_marker_in_aut_and_spec: + disc bool v in any; + marked v = true; + location: + initial; +end +marked double_marker_in_aut_and_spec.v = false; + +group six_marker: + automaton six_marker: + disc bool v in any; + marked v = true; + marked v = false; + location: + initial; + end + marked six_marker.v = true; + marked six_marker.v = false; +end +marked six_marker.six_marker.v = true; +marked six_marker.six_marker.v = false; + +automaton marker_not_binexpr: + disc bool v in any; + marked v; + location: + initial; +end + +automaton marker_not_equal_binexpr: + disc bool v in any; + marked v and v; + location: + initial; +end + +automaton marker_var_not_on_the_left: + disc bool v in any; + marked true = v; + location: + initial; +end + +// In the CIF metamodel, function parameters and local variables are represented as 'DiscVariable'. +func int func_param_and_local_var(int p): + int v = p; + v := v + 1; + return v; +end + +automaton def AutDef(): + disc int v in any; + marked v = 1; + location: + initial; +end +inst1: AutDef(); +inst2: AutDef(); +marked inst1.v = 2; +marked inst2.v = 3; diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err new file mode 100644 index 000000000..cd77c15f2 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err @@ -0,0 +1,9 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "double_marker_grp.double_marker_in_aut_and_grp.v": discrete variable has multiple predicates that specify its marked values. + - Unsupported "double_marker_in_aut.v": discrete variable has multiple predicates that specify its marked values. + - Unsupported "double_marker_in_aut_and_spec.v": discrete variable has multiple predicates that specify its marked values. + - Unsupported "marker_not_binexpr": automaton has a marker predicate that is not of the form "discrete_variable = marked_value". + - Unsupported "marker_not_equal_binexpr": automaton has a marker predicate that is not of the form "discrete_variable = marked_value". + - Unsupported "marker_var_not_on_the_left": automaton has a marker predicate that is not of the form "discrete_variable = marked_value". + - Unsupported "six_marker.six_marker.v": discrete variable has multiple predicates that specify its marked values. + - Unsupported specification: the top level scope of the specification has a marker predicate that is not of the form "discrete_variable = marked_value". diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif new file mode 100644 index 000000000..9989510c2 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif @@ -0,0 +1,87 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +invariant 1 = 1; +invariant 2 = 2; +plant 3 = 3; +plant 4 = 4; + +group state_inv: + invariant 1 = 1; + + group p: + plant invariant 2 = 2; + end + + group req: + requirement invariant 3 = 3; + end + + group sup: + supervisor invariant 4 = 4; + end + + group def Kindless(): + invariant 1 = 1; + end + + group def Pl(): + plant invariant 2 = 2; + end + + group def Req(): + requirement invariant 3 = 3; + end + + automaton def Sup(): + supervisor invariant 4 = 4; + location: + initial; + end +end + +group state_event_excl_inv: + event e; + + invariant e needs 1 = 1; + + group p: + plant invariant e needs 2 = 2; + end + + group req: + requirement invariant e needs 3 = 3; + end + + group sup: + supervisor invariant e needs 4 = 4; + end + + group def Kindless(): + invariant e needs 1 = 1; + end + + group def Pl(): + plant invariant e needs 2 = 2; + end + + group def Req(): + requirement invariant e needs 3 = 3; + end + + automaton def Sup(): + supervisor invariant e needs 4 = 4; + location: + initial; + end +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif.check.err new file mode 100644 index 000000000..b269b25db --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif.check.err @@ -0,0 +1,9 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "state_inv": group has a kindless state invariant. + - Unsupported "state_inv.Kindless": group definition has a kindless state invariant. + - Unsupported "state_inv.p": group has a plant state invariant. + - Unsupported "state_inv.Pl": group definition has a plant state invariant. + - Unsupported "state_inv.Sup": automaton definition has a supervisor state invariant. + - Unsupported "state_inv.sup": group has a supervisor state invariant. + - Unsupported specification: the top level scope of the specification has a kindless state invariant. + - Unsupported specification: the top level scope of the specification has a plant state invariant. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif new file mode 100644 index 000000000..396bdaffb --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif @@ -0,0 +1,94 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +event e; + +automaton a: + disc int va, vb; + disc list[3] int li; + + location l1: + initial; + edge e goto l2; // No update. + location l2: + edge e do va := 1, vb := 2 goto l3; // Multiple simple updates. + location l3: + edge e do (va, vb) := (1, 2) goto l4; // Multi-assignment. + location l4: + edge e do li[0] := 1 goto l5; // Partial assignment. + location l5: + edge e do if true: va := 1 end goto l1; // 'if' update. +end + +automaton multi_asgn: + disc int va, vb; + + location: + initial; + edge e do (va, vb) := (1, 2); // Multi-assignment. +end + +automaton partial_asgn: + disc list[3] int li; + + location: + initial; + edge e do li[0] := 1; // Partial assignment. +end + +automaton if_upd: + disc int v; + + location: + initial; + edge e do if true: v := 1 end; // 'if' update. +end + +group g: + automaton def A(): + disc int va, vb; + disc list[3] int li; + + location l1: + initial; + edge e goto l2; // No update. + location l2: + edge e do va := 1, vb := 2 goto l3; // Multiple simple updates. + location l3: + edge e do (va, vb) := (1, 2) goto l4; // Multi-assignment. + location l4: + edge e do li[0] := 1 goto l5; // Partial assignment. + location l5: + edge e do if true: va := 1 end goto l1; // 'if' update. + end +end + +automaton all: + disc int va, vb; + disc list[3] int li; + + location: + initial; + edge e; // No update. + edge e do va := 1, vb := 2; // Multiple simple updates. + edge e do va := 3, vb := 4; // Multiple simple updates. + + edge e do (va, vb) := (1, 2); // Multi-assignment. + edge e do (vb, va) := (3, 4); // Multi-assignment. + + edge e do li[0] := 1; // Partial assignment. + edge e do li[1] := 2; // Partial assignment. + + edge e do if true: va := 1 end; // 'if' update. + edge e do if true: va := 1 end; // 'if' update. +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif.check.err new file mode 100644 index 000000000..38921eb60 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif.check.err @@ -0,0 +1,5 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "a.l5": location has an edge with an 'if' update. + - Unsupported "all": automaton has an edge with an 'if' update. + - Unsupported "g.A.l5": location has an edge with an 'if' update. + - Unsupported "if_upd": automaton has an edge with an 'if' update. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif new file mode 100644 index 000000000..72fd3b4f6 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif @@ -0,0 +1,95 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +event e; + +automaton a: + disc int va, vb; + disc list[3] int li; + + location l1: + initial; + edge e goto l2; // No update. + location l2: + edge e do va := 1, vb := 2 goto l3; // Multiple simple updates. + location l3: + edge e do (va, vb) := (1, 2) goto l4; // Multi-assignment. + location l4: + edge e do li[0] := 1 goto l5; // Partial assignment. + location l5: + edge e do if true: va := 1 end goto l1; // 'if' update. +end + +automaton multi_asgn: + disc int va, vb; + + location: + initial; + edge e do (va, vb) := (1, 2); // Multi-assignment. +end + +automaton partial_asgn: + disc list[3] int li; + + location: + initial; + edge e do li[0] := 1; // Partial assignment. +end + +automaton if_upd: + disc int v; + + location: + initial; + edge e do if true: v := 1 end; // 'if' update. +end + +group g: + automaton def A(): + disc int va, vb; + disc list[3] int li; + + location l1: + initial; + edge e goto l2; // No update. + location l2: + edge e do va := 1, vb := 2 goto l3; // Multiple simple updates. + location l3: + edge e do (va, vb) := (1, 2) goto l4; // Multi-assignment. + location l4: + edge e do li[0] := 1 goto l5; // Partial assignment. + location l5: + edge e do if true: va := 1 end goto l1; // 'if' update. + end +end + +automaton all: + disc int va, vb; + disc list[3] int li; + + location: + initial; + edge e; // No update. + + edge e do va := 1, vb := 2; // Multiple simple updates. + edge e do va := 3, vb := 4; // Multiple simple updates. + + edge e do (va, vb) := (1, 2); // Multi-assignment. + edge e do (vb, va) := (3, 4); // Multi-assignment. + + edge e do li[0] := 1; // Partial assignment. + edge e do li[1] := 2; // Partial assignment. + + edge e do if true: va := 1 end; // 'if' update. + edge e do if true: va := 1 end; // 'if' update. +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif.check.err new file mode 100644 index 000000000..926205a53 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif.check.err @@ -0,0 +1,5 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "a.l3": location has an edge with a multi-assignment. + - Unsupported "all": automaton has an edge with a multi-assignment. + - Unsupported "g.A.l3": location has an edge with a multi-assignment. + - Unsupported "multi_asgn": automaton has an edge with a multi-assignment. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif new file mode 100644 index 000000000..72fd3b4f6 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif @@ -0,0 +1,95 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +event e; + +automaton a: + disc int va, vb; + disc list[3] int li; + + location l1: + initial; + edge e goto l2; // No update. + location l2: + edge e do va := 1, vb := 2 goto l3; // Multiple simple updates. + location l3: + edge e do (va, vb) := (1, 2) goto l4; // Multi-assignment. + location l4: + edge e do li[0] := 1 goto l5; // Partial assignment. + location l5: + edge e do if true: va := 1 end goto l1; // 'if' update. +end + +automaton multi_asgn: + disc int va, vb; + + location: + initial; + edge e do (va, vb) := (1, 2); // Multi-assignment. +end + +automaton partial_asgn: + disc list[3] int li; + + location: + initial; + edge e do li[0] := 1; // Partial assignment. +end + +automaton if_upd: + disc int v; + + location: + initial; + edge e do if true: v := 1 end; // 'if' update. +end + +group g: + automaton def A(): + disc int va, vb; + disc list[3] int li; + + location l1: + initial; + edge e goto l2; // No update. + location l2: + edge e do va := 1, vb := 2 goto l3; // Multiple simple updates. + location l3: + edge e do (va, vb) := (1, 2) goto l4; // Multi-assignment. + location l4: + edge e do li[0] := 1 goto l5; // Partial assignment. + location l5: + edge e do if true: va := 1 end goto l1; // 'if' update. + end +end + +automaton all: + disc int va, vb; + disc list[3] int li; + + location: + initial; + edge e; // No update. + + edge e do va := 1, vb := 2; // Multiple simple updates. + edge e do va := 3, vb := 4; // Multiple simple updates. + + edge e do (va, vb) := (1, 2); // Multi-assignment. + edge e do (vb, va) := (3, 4); // Multi-assignment. + + edge e do li[0] := 1; // Partial assignment. + edge e do li[1] := 2; // Partial assignment. + + edge e do if true: va := 1 end; // 'if' update. + edge e do if true: va := 1 end; // 'if' update. +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif.check.err new file mode 100644 index 000000000..332a9c51f --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif.check.err @@ -0,0 +1,5 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "a.l4": location has an edge with a partial variable assignment. + - Unsupported "all": automaton has an edge with a partial variable assignment. + - Unsupported "g.A.l4": location has an edge with a partial variable assignment. + - Unsupported "partial_asgn": automaton has an edge with a partial variable assignment. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif new file mode 100644 index 000000000..01aa74c3d --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif @@ -0,0 +1,40 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +event e; + +automaton a: + location l1: + initial; + edge e goto l2; // Non-urgent. + location l2: + edge e now goto l3; // Urgent. + location l3: + edge e goto l4; // Non-urgent. + location l4: + edge e now goto l1; // Urgent. +end + +group g: + automaton def A(): + location l1: + initial; + edge e goto l2; // Non-urgent. + location l2: + edge e now goto l3; // Urgent. + location l3: + edge e goto l4; // Non-urgent. + location l4: + edge e now goto l1; // Urgent. + end +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif.check.err new file mode 100644 index 000000000..24c843da0 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif.check.err @@ -0,0 +1,5 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "a.l2": location has an urgent edge. + - Unsupported "a.l4": location has an urgent edge. + - Unsupported "g.A.l2": location has an urgent edge. + - Unsupported "g.A.l4": location has an urgent edge. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif new file mode 100644 index 000000000..72fd3b4f6 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif @@ -0,0 +1,95 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +event e; + +automaton a: + disc int va, vb; + disc list[3] int li; + + location l1: + initial; + edge e goto l2; // No update. + location l2: + edge e do va := 1, vb := 2 goto l3; // Multiple simple updates. + location l3: + edge e do (va, vb) := (1, 2) goto l4; // Multi-assignment. + location l4: + edge e do li[0] := 1 goto l5; // Partial assignment. + location l5: + edge e do if true: va := 1 end goto l1; // 'if' update. +end + +automaton multi_asgn: + disc int va, vb; + + location: + initial; + edge e do (va, vb) := (1, 2); // Multi-assignment. +end + +automaton partial_asgn: + disc list[3] int li; + + location: + initial; + edge e do li[0] := 1; // Partial assignment. +end + +automaton if_upd: + disc int v; + + location: + initial; + edge e do if true: v := 1 end; // 'if' update. +end + +group g: + automaton def A(): + disc int va, vb; + disc list[3] int li; + + location l1: + initial; + edge e goto l2; // No update. + location l2: + edge e do va := 1, vb := 2 goto l3; // Multiple simple updates. + location l3: + edge e do (va, vb) := (1, 2) goto l4; // Multi-assignment. + location l4: + edge e do li[0] := 1 goto l5; // Partial assignment. + location l5: + edge e do if true: va := 1 end goto l1; // 'if' update. + end +end + +automaton all: + disc int va, vb; + disc list[3] int li; + + location: + initial; + edge e; // No update. + + edge e do va := 1, vb := 2; // Multiple simple updates. + edge e do va := 3, vb := 4; // Multiple simple updates. + + edge e do (va, vb) := (1, 2); // Multi-assignment. + edge e do (vb, va) := (3, 4); // Multi-assignment. + + edge e do li[0] := 1; // Partial assignment. + edge e do li[1] := 2; // Partial assignment. + + edge e do if true: va := 1 end; // 'if' update. + edge e do if true: va := 1 end; // 'if' update. +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err new file mode 100644 index 000000000..b4d7c66f6 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err @@ -0,0 +1,13 @@ +ERROR: CIF checks tester failed due to unsatisfied preconditions: + - Unsupported "a.l3": location has an edge with a multi-assignment. + - Unsupported "a.l4": location has an edge with a partial variable assignment. + - Unsupported "a.l5": location has an edge with an 'if' update. + - Unsupported "all": automaton has an edge with a multi-assignment. + - Unsupported "all": automaton has an edge with a partial variable assignment. + - Unsupported "all": automaton has an edge with an 'if' update. + - Unsupported "g.A.l3": location has an edge with a multi-assignment. + - Unsupported "g.A.l4": location has an edge with a partial variable assignment. + - Unsupported "g.A.l5": location has an edge with an 'if' update. + - Unsupported "if_upd": automaton has an edge with an 'if' update. + - Unsupported "multi_asgn": automaton has an edge with a multi-assignment. + - Unsupported "partial_asgn": automaton has an edge with a partial variable assignment. -- GitLab From 6773b8400db967e2074e4416568b5d3c32c6eaa6 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 11 Sep 2022 22:01:06 +0200 Subject: [PATCH 17/51] #416 Rename of CIF common checks tests. --- ...stApp.java => CifCommonChecksTestApp.java} | 22 +++++++------- .../org/eclipse/escet/cif/tests/CifTest.java | 6 ++-- .../AutOnlyWithOneInitLocCheck.cif.check.err | 29 ------------------- .../AutNoKindlessCheck.cif | 0 .../AutNoKindlessCheck.cif.check.err | 2 +- .../AutOnlyWithOneInitLocCheck.cif | 0 .../AutOnlyWithOneInitLocCheck.cif.check.err | 29 +++++++++++++++++++ .../CompNoInitPredsCheck.cif | 0 .../CompNoInitPredsCheck.cif.check.err | 2 +- .../CompOnlyVarValueMarkerPredsCheck.cif | 0 ...OnlyVarValueMarkerPredsCheck.cif.check.err | 2 +- .../CompStateInvsOnlyReqsCheck.cif | 0 .../CompStateInvsOnlyReqsCheck.cif.check.err | 2 +- .../EdgeNoIfUpdatesCheck.cif | 0 .../EdgeNoIfUpdatesCheck.cif.check.err | 2 +- .../EdgeNoMultiAssignCheck.cif | 0 .../EdgeNoMultiAssignCheck.cif.check.err | 2 +- .../EdgeNoPartialVarAssignCheck.cif | 0 .../EdgeNoPartialVarAssignCheck.cif.check.err | 2 +- .../EdgeNoUrgentCheck.cif | 0 .../EdgeNoUrgentCheck.cif.check.err | 2 +- .../EdgeOnlySimpleAssignmentsCheck.cif | 0 ...geOnlySimpleAssignmentsCheck.cif.check.err | 2 +- .../tests/test_all.tooldef | 2 +- ...cks.tooldef => test_common_checks.tooldef} | 4 +-- 25 files changed, 55 insertions(+), 55 deletions(-) rename cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/{CifChecksTestApp.java => CifCommonChecksTestApp.java} (86%) delete mode 100644 cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif.check.err rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/AutNoKindlessCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/AutNoKindlessCheck.cif.check.err (83%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/AutOnlyWithOneInitLocCheck.cif (100%) create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/AutOnlyWithOneInitLocCheck.cif.check.err rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/CompNoInitPredsCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/CompNoInitPredsCheck.cif.check.err (84%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/CompOnlyVarValueMarkerPredsCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/CompOnlyVarValueMarkerPredsCheck.cif.check.err (93%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/CompStateInvsOnlyReqsCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/CompStateInvsOnlyReqsCheck.cif.check.err (89%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeNoIfUpdatesCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeNoIfUpdatesCheck.cif.check.err (78%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeNoMultiAssignCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeNoMultiAssignCheck.cif.check.err (79%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeNoPartialVarAssignCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeNoPartialVarAssignCheck.cif.check.err (81%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeNoUrgentCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeNoUrgentCheck.cif.check.err (74%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeOnlySimpleAssignmentsCheck.cif (100%) rename cif/org.eclipse.escet.cif.tests/tests/{checks => common_checks}/EdgeOnlySimpleAssignmentsCheck.cif.check.err (92%) rename cif/org.eclipse.escet.cif.tests/tests/{test_checks.tooldef => test_common_checks.tooldef} (97%) diff --git a/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifChecksTestApp.java b/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifCommonChecksTestApp.java similarity index 86% rename from cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifChecksTestApp.java rename to cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifCommonChecksTestApp.java index 0302614aa..4d4ae4590 100644 --- a/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifChecksTestApp.java +++ b/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifCommonChecksTestApp.java @@ -31,25 +31,25 @@ import org.eclipse.escet.common.app.framework.options.StringOption; import org.eclipse.escet.common.app.framework.output.IOutputComponent; import org.eclipse.escet.common.app.framework.output.OutputProvider; -/** CIF checks test application. */ -public class CifChecksTestApp extends Application { +/** CIF common checks test application. */ +public class CifCommonChecksTestApp extends Application { /** - * Constructor for the {@link CifChecksTestApp} class. + * Constructor for the {@link CifCommonChecksTestApp} class. * * @param streams The streams to use for input, output, and error streams. */ - public CifChecksTestApp(AppStreams streams) { + public CifCommonChecksTestApp(AppStreams streams) { super(streams); } @Override public String getAppName() { - return "CIF checks tester"; + return "CIF common checks tester"; } @Override public String getAppDescription() { - return "Tests checks on CIF specification."; + return "Tests common checks on CIF specification."; } @Override @@ -80,7 +80,7 @@ public class CifChecksTestApp extends Application { checks.add(check); // Perform check. - new CifPreconditionChecker(checks).reportPreconditionViolations(spec, "CIF checks tester"); + new CifPreconditionChecker(checks).reportPreconditionViolations(spec, "CIF common checks tester"); // All done. return 0; @@ -98,13 +98,13 @@ public class CifChecksTestApp extends Application { OptionCategory transOpts = new OptionCategory("Checks", "Check options.", list(), list( Options.getInstance(InputFileOption.class), Options.getInstance(CifCheckClassNameToTestOption.class))); - OptionCategory options = new OptionCategory("CIF Checks Tester Options", - "All options for the CIF checks tester.", list(generalOpts, transOpts), list()); + OptionCategory options = new OptionCategory("CIF Common Checks Tester Options", + "All options for the CIF common checks tester.", list(generalOpts, transOpts), list()); return options; } - /** CIF check class name option. */ + /** CIF common check class name option. */ public static class CifCheckClassNameToTestOption extends StringOption { /** Constructor for the {@link CifCheckClassNameToTestOption} class. */ public CifCheckClassNameToTestOption() { @@ -113,7 +113,7 @@ public class CifChecksTestApp extends Application { "Check", // description - "Specify the name of the check class to test.", + "Specify the name of the common check class to test.", // cmdShort null, diff --git a/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifTest.java b/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifTest.java index fe7205ff1..4ef7a143d 100644 --- a/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifTest.java +++ b/cif/org.eclipse.escet.cif.tests/src-test/org/eclipse/escet/cif/tests/CifTest.java @@ -24,10 +24,10 @@ public class CifTest extends ToolDefBasedPluginUnitTest { test("tests/test_tchecker.tooldef"); } - /** Checks tests. */ + /** Common checks tests. */ @Test - public void testCifChecks() { - test("tests/test_checks.tooldef"); + public void testCommonChecks() { + test("tests/test_common_checks.tooldef"); } /** Pretty print and elimination of component definition/instantiation tests. */ diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif.check.err deleted file mode 100644 index e91c4db9b..000000000 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif.check.err +++ /dev/null @@ -1,29 +0,0 @@ -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 30, column 13: Automaton "auts.no_init_loc" has no initial location. -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 31, column 14: Location "l1" is not reachable from any of the initial locations of automaton "auts.no_init_loc". -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 34, column 14: Location "l2" is not reachable from any of the initial locations of automaton "auts.no_init_loc". -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 36, column 14: Location "l3" is not reachable from any of the initial locations of automaton "auts.no_init_loc". -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 92, column 17: Automaton "autdefs.no_init_loc" has no initial location. -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 93, column 14: Location "l1" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 96, column 14: Location "l2" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 98, column 14: Location "l3" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 144, column 47: Location parameter "loc_params_one_initial.a" is not used anywhere in the specification. -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 144, column 50: Location parameter "loc_params_one_initial.b" is not used anywhere in the specification. -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 15: Automaton "loc_params_no_initial" has no initial location. -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 46: Location parameter "loc_params_no_initial.a" is not used anywhere in the specification. -WARNING: File "checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 49: Location parameter "loc_params_no_initial.b" is not used anywhere in the specification. -ERROR: CIF checks tester failed due to unsatisfied preconditions: - - Unsupported "autdefs.init_pred_eval_error_report_on_aut": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. - - Unsupported "autdefs.init_pred_eval_error_report_on_loc.loc": failed to determine whether the location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. - - Unsupported "autdefs.init_pred_non_static_eval_report_on_aut": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates can not be statically evaluated. - - Unsupported "autdefs.init_pred_non_static_eval_report_on_loc.loc": failed to determine whether the location is an initial location, as one of its initialization predicates can not be statically evaluated. - - Unsupported "autdefs.no_init_loc": automaton definition has no initial location. - - Unsupported "autdefs.three_init_loc": automaton definition has multiple (3) initial locations. - - Unsupported "autdefs.two_init_loc": automaton definition has multiple (2) initial locations. - - Unsupported "auts.init_pred_eval_error_report_on_aut": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. - - Unsupported "auts.init_pred_eval_error_report_on_loc.loc": failed to determine whether the location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. - - Unsupported "auts.init_pred_non_static_eval_report_on_aut": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates can not be statically evaluated. - - Unsupported "auts.init_pred_non_static_eval_report_on_loc.loc": failed to determine whether the location is an initial location, as one of its initialization predicates can not be statically evaluated. - - Unsupported "auts.no_init_loc": automaton has no initial location. - - Unsupported "auts.three_init_loc": automaton has multiple (3) initial locations. - - Unsupported "auts.two_init_loc": automaton has multiple (2) initial locations. - - Unsupported "loc_params_no_initial": automaton definition has no initial location. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/AutNoKindlessCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/AutNoKindlessCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/AutNoKindlessCheck.cif.check.err similarity index 83% rename from cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/AutNoKindlessCheck.cif.check.err index 144b2ead4..ff20491e0 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/AutNoKindlessCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/AutNoKindlessCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "A1": automaton definition is a kindless automaton, lacking a supervisory kind. - Unsupported "a1": automaton is a kindless automaton, lacking a supervisory kind. - Unsupported "g.A1": automaton definition is a kindless automaton, lacking a supervisory kind. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/AutOnlyWithOneInitLocCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/AutOnlyWithOneInitLocCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/AutOnlyWithOneInitLocCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/AutOnlyWithOneInitLocCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/AutOnlyWithOneInitLocCheck.cif.check.err new file mode 100644 index 000000000..1639c9225 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/AutOnlyWithOneInitLocCheck.cif.check.err @@ -0,0 +1,29 @@ +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 30, column 13: Automaton "auts.no_init_loc" has no initial location. +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 31, column 14: Location "l1" is not reachable from any of the initial locations of automaton "auts.no_init_loc". +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 34, column 14: Location "l2" is not reachable from any of the initial locations of automaton "auts.no_init_loc". +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 36, column 14: Location "l3" is not reachable from any of the initial locations of automaton "auts.no_init_loc". +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 92, column 17: Automaton "autdefs.no_init_loc" has no initial location. +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 93, column 14: Location "l1" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 96, column 14: Location "l2" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 98, column 14: Location "l3" is not reachable from any of the initial locations of automaton "autdefs.no_init_loc". +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 144, column 47: Location parameter "loc_params_one_initial.a" is not used anywhere in the specification. +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 144, column 50: Location parameter "loc_params_one_initial.b" is not used anywhere in the specification. +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 15: Automaton "loc_params_no_initial" has no initial location. +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 46: Location parameter "loc_params_no_initial.a" is not used anywhere in the specification. +WARNING: File "common_checks/AutOnlyWithOneInitLocCheck.cif": Semantic warning at line 149, column 49: Location parameter "loc_params_no_initial.b" is not used anywhere in the specification. +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "autdefs.init_pred_eval_error_report_on_aut": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "autdefs.init_pred_eval_error_report_on_loc.loc": failed to determine whether the location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "autdefs.init_pred_non_static_eval_report_on_aut": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "autdefs.init_pred_non_static_eval_report_on_loc.loc": failed to determine whether the location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "autdefs.no_init_loc": automaton definition has no initial location. + - Unsupported "autdefs.three_init_loc": automaton definition has multiple (3) initial locations. + - Unsupported "autdefs.two_init_loc": automaton definition has multiple (2) initial locations. + - Unsupported "auts.init_pred_eval_error_report_on_aut": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "auts.init_pred_eval_error_report_on_loc.loc": failed to determine whether the location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. + - Unsupported "auts.init_pred_non_static_eval_report_on_aut": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "auts.init_pred_non_static_eval_report_on_loc.loc": failed to determine whether the location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "auts.no_init_loc": automaton has no initial location. + - Unsupported "auts.three_init_loc": automaton has multiple (3) initial locations. + - Unsupported "auts.two_init_loc": automaton has multiple (2) initial locations. + - Unsupported "loc_params_no_initial": automaton definition has no initial location. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompNoInitPredsCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/CompNoInitPredsCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompNoInitPredsCheck.cif.check.err similarity index 84% rename from cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/CompNoInitPredsCheck.cif.check.err index ae40cf8ae..98acc05cb 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/CompNoInitPredsCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompNoInitPredsCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "g": group contains an initialization predicate. - Unsupported "g.a": automaton contains an initialization predicate. - Unsupported "g.A": automaton definition contains an initialization predicate. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompOnlyVarValueMarkerPredsCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/CompOnlyVarValueMarkerPredsCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err similarity index 93% rename from cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err index cd77c15f2..bd432ac31 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompOnlyVarValueMarkerPredsCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "double_marker_grp.double_marker_in_aut_and_grp.v": discrete variable has multiple predicates that specify its marked values. - Unsupported "double_marker_in_aut.v": discrete variable has multiple predicates that specify its marked values. - Unsupported "double_marker_in_aut_and_spec.v": discrete variable has multiple predicates that specify its marked values. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompStateInvsOnlyReqsCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/CompStateInvsOnlyReqsCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompStateInvsOnlyReqsCheck.cif.check.err similarity index 89% rename from cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/CompStateInvsOnlyReqsCheck.cif.check.err index b269b25db..6fc8b476a 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/CompStateInvsOnlyReqsCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/CompStateInvsOnlyReqsCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "state_inv": group has a kindless state invariant. - Unsupported "state_inv.Kindless": group definition has a kindless state invariant. - Unsupported "state_inv.p": group has a plant state invariant. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoIfUpdatesCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoIfUpdatesCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoIfUpdatesCheck.cif.check.err similarity index 78% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoIfUpdatesCheck.cif.check.err index 38921eb60..d984afdae 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoIfUpdatesCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoIfUpdatesCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "a.l5": location has an edge with an 'if' update. - Unsupported "all": automaton has an edge with an 'if' update. - Unsupported "g.A.l5": location has an edge with an 'if' update. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoMultiAssignCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoMultiAssignCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoMultiAssignCheck.cif.check.err similarity index 79% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoMultiAssignCheck.cif.check.err index 926205a53..6ace0e0ea 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoMultiAssignCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoMultiAssignCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "a.l3": location has an edge with a multi-assignment. - Unsupported "all": automaton has an edge with a multi-assignment. - Unsupported "g.A.l3": location has an edge with a multi-assignment. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoPartialVarAssignCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoPartialVarAssignCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoPartialVarAssignCheck.cif.check.err similarity index 81% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoPartialVarAssignCheck.cif.check.err index 332a9c51f..e6141e799 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoPartialVarAssignCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoPartialVarAssignCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "a.l4": location has an edge with a partial variable assignment. - Unsupported "all": automaton has an edge with a partial variable assignment. - Unsupported "g.A.l4": location has an edge with a partial variable assignment. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoUrgentCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoUrgentCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoUrgentCheck.cif.check.err similarity index 74% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoUrgentCheck.cif.check.err index 24c843da0..87ec44bb8 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeNoUrgentCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeNoUrgentCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "a.l2": location has an urgent edge. - Unsupported "a.l4": location has an urgent edge. - Unsupported "g.A.l2": location has an urgent edge. diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeOnlySimpleAssignmentsCheck.cif similarity index 100% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeOnlySimpleAssignmentsCheck.cif diff --git a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err similarity index 92% rename from cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err rename to cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err index b4d7c66f6..9237ade1c 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EdgeOnlySimpleAssignmentsCheck.cif.check.err @@ -1,4 +1,4 @@ -ERROR: CIF checks tester failed due to unsatisfied preconditions: +ERROR: CIF common checks tester failed due to unsatisfied preconditions: - Unsupported "a.l3": location has an edge with a multi-assignment. - Unsupported "a.l4": location has an edge with a partial variable assignment. - Unsupported "a.l5": location has an edge with an 'if' update. diff --git a/cif/org.eclipse.escet.cif.tests/tests/test_all.tooldef b/cif/org.eclipse.escet.cif.tests/tests/test_all.tooldef index cfea05430..b734181d5 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/test_all.tooldef +++ b/cif/org.eclipse.escet.cif.tests/tests/test_all.tooldef @@ -13,7 +13,7 @@ int failures; failures = failures + tooldef("test_tchecker.tooldef", ignoreNonZeroExitCode=true); -failures = failures + tooldef("test_checks.tooldef", ignoreNonZeroExitCode=true); +failures = failures + tooldef("test_common_checks.tooldef", ignoreNonZeroExitCode=true); failures = failures + tooldef("test_pprint_elim_cdef.tooldef", ignoreNonZeroExitCode=true); failures = failures + tooldef("test_cif2cif.tooldef", ignoreNonZeroExitCode=true); diff --git a/cif/org.eclipse.escet.cif.tests/tests/test_checks.tooldef b/cif/org.eclipse.escet.cif.tests/tests/test_common_checks.tooldef similarity index 97% rename from cif/org.eclipse.escet.cif.tests/tests/test_checks.tooldef rename to cif/org.eclipse.escet.cif.tests/tests/test_common_checks.tooldef index 6bc77a097..c6024379f 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/test_checks.tooldef +++ b/cif/org.eclipse.escet.cif.tests/tests/test_common_checks.tooldef @@ -14,13 +14,13 @@ tool int check(list string args = [], string stdin = "-", string stdout = "-", string stderr = "-", bool appendOut = false, bool appendErr = false, bool errToOut = false, bool ignoreNonZeroExitCode = false): - return app("org.eclipse.escet.cif.tests", "org.eclipse.escet.cif.tests.CifChecksTestApp", args, stdin, stdout, + return app("org.eclipse.escet.cif.tests", "org.eclipse.escet.cif.tests.CifCommonChecksTestApp", args, stdin, stdout, stderr, appendOut, appendErr, errToOut, ignoreNonZeroExitCode); end // Configuration. -string test_path = "checks"; +string test_path = "common_checks"; string test_pattern = "*.cif"; list string default_options = ["--devmode=1"]; map(string:list string) test_options = {}; -- GitLab From d220c51de7ba17388a32d66040f4e4509b8a693d Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Mon, 12 Sep 2022 16:58:02 +0200 Subject: [PATCH 18/51] #416 More common checks tests. --- .../common_checks/EventNoChannelsCheck.cif | 34 ++++++++ .../EventNoChannelsCheck.cif.check.err | 21 +++++ .../tests/common_checks/EventNoTauCheck.cif | 35 ++++++++ .../EventNoTauCheck.cif.check.err | 9 ++ .../EventOnlyWithControllabilityCheck.cif | 47 +++++++++++ ...OnlyWithControllabilityCheck.cif.check.err | 12 +++ .../common_checks/FuncNoUserDefinedCheck.cif | 26 ++++++ .../FuncNoUserDefinedCheck.cif.check.err | 5 ++ .../InvNoKindlessStateEvtExclCheck.cif | 84 +++++++++++++++++++ ...vNoKindlessStateEvtExclCheck.cif.check.err | 9 ++ .../common_checks/LocNoStateInvsCheck.cif | 68 +++++++++++++++ .../LocNoStateInvsCheck.cif.check.err | 6 ++ .../tests/common_checks/LocNoUrgentCheck.cif | 36 ++++++++ .../LocNoUrgentCheck.cif.check.err | 5 ++ .../LocOnlyStaticEvalMarkerPredsCheck.cif | 48 +++++++++++ ...lyStaticEvalMarkerPredsCheck.cif.check.err | 5 ++ .../common_checks/VarNoContinuousCheck.cif | 26 ++++++ .../VarNoContinuousCheck.cif.check.err | 4 + .../VarNoDiscWithMultiInitValuesCheck.cif | 29 +++++++ ...DiscWithMultiInitValuesCheck.cif.check.err | 10 +++ .../tests/common_checks/VarNoInputCheck.cif | 32 +++++++ .../VarNoInputCheck.cif.check.err | 8 ++ 22 files changed, 559 insertions(+) create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoChannelsCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoChannelsCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoTauCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoTauCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/EventOnlyWithControllabilityCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/EventOnlyWithControllabilityCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/FuncNoUserDefinedCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/FuncNoUserDefinedCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/InvNoKindlessStateEvtExclCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/InvNoKindlessStateEvtExclCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoStateInvsCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoStateInvsCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoUrgentCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoUrgentCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoContinuousCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoContinuousCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoDiscWithMultiInitValuesCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoDiscWithMultiInitValuesCheck.cif.check.err create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoInputCheck.cif create mode 100644 cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoInputCheck.cif.check.err diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoChannelsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoChannelsCheck.cif new file mode 100644 index 000000000..7fa7719fe --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoChannelsCheck.cif @@ -0,0 +1,34 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +event e; +event void c1; +event int c2; + +group g: + event e; + event void c1; + event int c2; + + automaton a: + event e; + controllable void c1; + uncontrollable int c2; + + location: + initial; + end +end + +group def G(event e; event void c1; event int c2): +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoChannelsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoChannelsCheck.cif.check.err new file mode 100644 index 000000000..2d25da5a5 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoChannelsCheck.cif.check.err @@ -0,0 +1,21 @@ +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 14, column 7: Event "e" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 15, column 12: Event "c1" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 16, column 11: Event "c2" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 19, column 9: Event "g.e" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 20, column 14: Event "g.c1" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 21, column 13: Event "g.c2" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 24, column 11: Event "g.a.e" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 25, column 23: Event "g.a.c1" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 26, column 24: Event "g.a.c2" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 33, column 19: Event parameter "G.e" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 33, column 33: Event parameter "G.c1" is not used anywhere in the specification. +WARNING: File "common_checks/EventNoChannelsCheck.cif": Semantic warning at line 33, column 47: Event parameter "G.c2" is not used anywhere in the specification. +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "c1": event is a channel (has a data type). + - Unsupported "c2": event is a channel (has a data type). + - Unsupported "g.a.c1": event is a channel (has a data type). + - Unsupported "g.a.c2": event is a channel (has a data type). + - Unsupported "g.c1": event is a channel (has a data type). + - Unsupported "G.c1": event parameter is a channel (has a data type). + - Unsupported "g.c2": event is a channel (has a data type). + - Unsupported "G.c2": event parameter is a channel (has a data type). diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoTauCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoTauCheck.cif new file mode 100644 index 000000000..0422d86d9 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoTauCheck.cif @@ -0,0 +1,35 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +automaton a1: + location: + initial; + edge when true; + edge tau; +end + +event e; + +automaton a2: + location l1: + initial; + edge when true goto l2; + location l2: + edge tau goto l3; + location l3: + edge tau, tau goto l4; + location l4: + edge e, tau goto l5; + location l5: + edge e goto l1; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoTauCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoTauCheck.cif.check.err new file mode 100644 index 000000000..7eb5fc045 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventNoTauCheck.cif.check.err @@ -0,0 +1,9 @@ +WARNING: File "common_checks/EventNoTauCheck.cif": Semantic warning at line 30, column 10: Duplicate event "tau" on a single edge in automaton "a2". +WARNING: File "common_checks/EventNoTauCheck.cif": Semantic warning at line 30, column 15: Duplicate event "tau" on a single edge in automaton "a2". +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "a1": automaton has an edge with explicitly event "tau" on it. + - Unsupported "a1": automaton has an edge with implicitly event "tau" on it. + - Unsupported "a2.l1": location has an edge with implicitly event "tau" on it. + - Unsupported "a2.l2": location has an edge with explicitly event "tau" on it. + - Unsupported "a2.l3": location has an edge with explicitly event "tau" on it. + - Unsupported "a2.l4": location has an edge with explicitly event "tau" on it. diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventOnlyWithControllabilityCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventOnlyWithControllabilityCheck.cif new file mode 100644 index 000000000..112e964b0 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventOnlyWithControllabilityCheck.cif @@ -0,0 +1,47 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +automaton tau_a1: + location: + initial; + edge when true; + edge tau; +end + +event e; + +automaton tau_a2: + location l1: + initial; + edge when true goto l2; + location l2: + edge tau goto l3; + location l3: + edge tau, tau goto l4; + location l4: + edge e, tau goto l5; + location l5: + edge e goto l1; +end + +group g: + event e; + controllable c; + uncontrollable u; + + automaton def A(event e2; controllable c2; uncontrollable u2): + location: + initial; + edge e, c, u, e2, c2, u2; + end +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventOnlyWithControllabilityCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventOnlyWithControllabilityCheck.cif.check.err new file mode 100644 index 000000000..689a2afae --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/EventOnlyWithControllabilityCheck.cif.check.err @@ -0,0 +1,12 @@ +WARNING: File "common_checks/EventOnlyWithControllabilityCheck.cif": Semantic warning at line 30, column 10: Duplicate event "tau" on a single edge in automaton "tau_a2". +WARNING: File "common_checks/EventOnlyWithControllabilityCheck.cif": Semantic warning at line 30, column 15: Duplicate event "tau" on a single edge in automaton "tau_a2". +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "e": event is not declared as controllable or uncontrollable. + - Unsupported "g.A.e2": event parameter is not declared as controllable or uncontrollable. + - Unsupported "g.e": event is not declared as controllable or uncontrollable. + - Unsupported "tau_a1": automaton has an edge with explicitly event "tau" on it, which is not controllable or uncontrollable. + - Unsupported "tau_a1": automaton has an edge with implicitly event "tau" on it, which is not controllable or uncontrollable. + - Unsupported "tau_a2.l1": location has an edge with implicitly event "tau" on it, which is not controllable or uncontrollable. + - Unsupported "tau_a2.l2": location has an edge with explicitly event "tau" on it, which is not controllable or uncontrollable. + - Unsupported "tau_a2.l3": location has an edge with explicitly event "tau" on it, which is not controllable or uncontrollable. + - Unsupported "tau_a2.l4": location has an edge with explicitly event "tau" on it, which is not controllable or uncontrollable. diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/FuncNoUserDefinedCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/FuncNoUserDefinedCheck.cif new file mode 100644 index 000000000..15a89de40 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/FuncNoUserDefinedCheck.cif @@ -0,0 +1,26 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +func int inc(int x): + return x + 1; +end + +func bool f(): "java:somepkg.SomeClass.someMethod|."; + +group g: + func int inc(int x): + return x + 1; + end + + func bool f(): "java:somepkg.SomeClass.someMethod|."; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/FuncNoUserDefinedCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/FuncNoUserDefinedCheck.cif.check.err new file mode 100644 index 000000000..34b32d238 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/FuncNoUserDefinedCheck.cif.check.err @@ -0,0 +1,5 @@ +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "f": function is a user-defined function. + - Unsupported "g.f": function is a user-defined function. + - Unsupported "g.inc": function is a user-defined function. + - Unsupported "inc": function is a user-defined function. diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/InvNoKindlessStateEvtExclCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/InvNoKindlessStateEvtExclCheck.cif new file mode 100644 index 000000000..b814bcc5d --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/InvNoKindlessStateEvtExclCheck.cif @@ -0,0 +1,84 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +event e; + +invariant e needs true; + +group g: + group p1: + invariant e needs true; + end + + group p2: + invariant true disables e; + end + + group p: + plant e needs true; + end + + group r: + requirement e needs true; + end + + group s: + supervisor e needs true; + end +end + +automaton different_locs: + location loc1: + initial; + invariant e needs true; + location loc2: + initial; + invariant true disables e; + location loc3: + initial; + plant e needs true; + location loc4: + initial; + requirement e needs true; + location loc5: + initial; + supervisor e needs true; +end + +automaton nameless_loc: + location: + initial; + invariant e needs true; + invariant true disables e; + plant e needs true; + requirement e needs true; + supervisor e needs true; +end + +automaton named_invs: + location: + initial; + invariant I1: e needs true; + invariant I2: true disables e; + plant I3: e needs true; + requirement I4: e needs true; + supervisor I5: e needs true; +end + +group state_invs: + invariant true; + invariant false; + plant true; + requirement true; + supervisor true; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/InvNoKindlessStateEvtExclCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/InvNoKindlessStateEvtExclCheck.cif.check.err new file mode 100644 index 000000000..d546b0fc6 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/InvNoKindlessStateEvtExclCheck.cif.check.err @@ -0,0 +1,9 @@ +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "different_locs.loc1": location has a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported "different_locs.loc2": location has a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported "g.p1": group has a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported "g.p2": group has a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported "named_invs.I1": invariant is a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported "named_invs.I2": invariant is a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported "nameless_loc": automaton has a kindless state/event exclusion invariant, lacking a supervisory kind. + - Unsupported specification: the top level scope of the specification has a kindless state/event exclusion invariant, lacking a supervisory kind. diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoStateInvsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoStateInvsCheck.cif new file mode 100644 index 000000000..e4af38964 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoStateInvsCheck.cif @@ -0,0 +1,68 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +invariant 1 = 1; + +automaton a: + invariant 1 = 1; + + location loc: + initial; + invariant 1 = 1; +end + +automaton nameless_loc: + location: + initial; + invariant 1 = 1; +end + +automaton named_inv: + location: + initial; + invariant I: 1 = 1; +end + +event e; + +group non_state_inv: + invariant e needs true; + invariant true disables e; + + automaton non_state_inv: + location loc: + initial; + invariant e needs true; + invariant true disables e; + end +end + +group state_inv_with_kind: + plant 1 = 1; + requirement 2 = 2; + supervisor 3 = 3; + + automaton non_state_inv: + location loc: + initial; + plant 1 = 1; + requirement 2 = 2; + supervisor 3 = 3; + plant e needs true; + end +end + +automaton def loc_param(location l): + location: + initial; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoStateInvsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoStateInvsCheck.cif.check.err new file mode 100644 index 000000000..5ac2c0f3b --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoStateInvsCheck.cif.check.err @@ -0,0 +1,6 @@ +WARNING: File "common_checks/LocNoStateInvsCheck.cif": Semantic warning at line 65, column 34: Location parameter "loc_param.l" is not used anywhere in the specification. +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "a.loc": location has a state invariant. + - Unsupported "named_inv": automaton has a location with a state invariant. + - Unsupported "nameless_loc": automaton has a location with a state invariant. + - Unsupported "state_inv_with_kind.non_state_inv.loc": location has a state invariant. diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoUrgentCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoUrgentCheck.cif new file mode 100644 index 000000000..aaae9a546 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoUrgentCheck.cif @@ -0,0 +1,36 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +automaton a: + location loc1: + initial; + urgent; + location loc2: + initial; + location loc3: + initial; + urgent; + location loc4: + initial; +end + +automaton nameless_loc: + location: + initial; + urgent; +end + +automaton def loc_param(location loc): + location: + initial; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoUrgentCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoUrgentCheck.cif.check.err new file mode 100644 index 000000000..4d1632e57 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocNoUrgentCheck.cif.check.err @@ -0,0 +1,5 @@ +WARNING: File "common_checks/LocNoUrgentCheck.cif": Semantic warning at line 33, column 34: Location parameter "loc_param.loc" is not used anywhere in the specification. +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "a.loc1": location is urgent. + - Unsupported "a.loc3": location is urgent. + - Unsupported "nameless_loc": automaton has an urgent location. diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif new file mode 100644 index 000000000..3578ee591 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif @@ -0,0 +1,48 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +func int zero(): + return 0; +end + +automaton a: + location loc1: + initial; + location loc2: + initial; + marked true; + location loc3: + initial; + marked false; + location loc4: + initial; + marked; + location loc5: + initial; + marked 1/0 = 1; // Evaluation failure. + location loc6: + initial; + marked zero() = 0; // Not statically evaluable. +end + +automaton nameless_loc: + location: + initial; + marked 1/0 = 1; // Evaluation failure. + marked zero() = 0; // Not statically evaluable. +end + +automaton def loc_param(location l): + location: + initial; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif.check.err new file mode 100644 index 000000000..3e7059305 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif.check.err @@ -0,0 +1,5 @@ +WARNING: File "common_checks/LocOnlyStaticEvalMarkerPredsCheck.cif": Semantic warning at line 45, column 34: Location parameter "loc_param.l" is not used anywhere in the specification. +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "a.loc5": location has a marker predicate that can not be evaluated statically, as the evaluation resulted in an evaluation error. + - Unsupported "a.loc6": location has a marker predicate that can not be evaluated statically. + - Unsupported "nameless_loc": automaton has a location with a marker predicate that can not be evaluated statically, as the evaluation resulted in an evaluation error. diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoContinuousCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoContinuousCheck.cif new file mode 100644 index 000000000..9c57f6c6f --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoContinuousCheck.cif @@ -0,0 +1,26 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +cont c der 1.0; + +group g: + cont c; + equation c' = 1.0; +end + +automaton a: + cont c der 1.0; + location: + initial; + edge do c := 5; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoContinuousCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoContinuousCheck.cif.check.err new file mode 100644 index 000000000..4feb18983 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoContinuousCheck.cif.check.err @@ -0,0 +1,4 @@ +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "a.c": variable is a continuous variable. + - Unsupported "c": variable is a continuous variable. + - Unsupported "g.c": variable is a continuous variable. diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoDiscWithMultiInitValuesCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoDiscWithMultiInitValuesCheck.cif new file mode 100644 index 000000000..b212e08d1 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoDiscWithMultiInitValuesCheck.cif @@ -0,0 +1,29 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +automaton a: + disc int v_default; + disc int v1 = 1; + disc int v2 in {2, 3}; + disc int v3 in {4, 5, 6}; + disc int v_any in any; + disc int vx = f(3); + + location: + initial; +end + +func int f(int x): + int y = x + 1; + return y; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoDiscWithMultiInitValuesCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoDiscWithMultiInitValuesCheck.cif.check.err new file mode 100644 index 000000000..1423955eb --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoDiscWithMultiInitValuesCheck.cif.check.err @@ -0,0 +1,10 @@ +WARNING: File "common_checks/VarNoDiscWithMultiInitValuesCheck.cif": Semantic warning at line 15, column 12: Discrete variable "a.v_default" is not used anywhere in the specification. +WARNING: File "common_checks/VarNoDiscWithMultiInitValuesCheck.cif": Semantic warning at line 16, column 12: Discrete variable "a.v1" is not used anywhere in the specification. +WARNING: File "common_checks/VarNoDiscWithMultiInitValuesCheck.cif": Semantic warning at line 17, column 12: Discrete variable "a.v2" is not used anywhere in the specification. +WARNING: File "common_checks/VarNoDiscWithMultiInitValuesCheck.cif": Semantic warning at line 18, column 12: Discrete variable "a.v3" is not used anywhere in the specification. +WARNING: File "common_checks/VarNoDiscWithMultiInitValuesCheck.cif": Semantic warning at line 19, column 12: Discrete variable "a.v_any" is not used anywhere in the specification. +WARNING: File "common_checks/VarNoDiscWithMultiInitValuesCheck.cif": Semantic warning at line 20, column 12: Discrete variable "a.vx" is not used anywhere in the specification. +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "a.v2": discrete variable has multiple (2) potential initial values. + - Unsupported "a.v3": discrete variable has multiple (3) potential initial values. + - Unsupported "a.v_any": discrete variable has multiple potential initial values (any value in its domain). diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoInputCheck.cif b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoInputCheck.cif new file mode 100644 index 000000000..691fcab64 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoInputCheck.cif @@ -0,0 +1,32 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +input bool i; + +group g: + input bool i; + input bool j; + + automaton a: + input bool i; + input bool j; + + location: + initial; + end +end + +group def G(): + input bool i; + input bool j; +end diff --git a/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoInputCheck.cif.check.err b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoInputCheck.cif.check.err new file mode 100644 index 000000000..b68102851 --- /dev/null +++ b/cif/org.eclipse.escet.cif.tests/tests/common_checks/VarNoInputCheck.cif.check.err @@ -0,0 +1,8 @@ +ERROR: CIF common checks tester failed due to unsatisfied preconditions: + - Unsupported "g.a.i": variable is an input variable. + - Unsupported "g.a.j": variable is an input variable. + - Unsupported "G.i": variable is an input variable. + - Unsupported "g.i": variable is an input variable. + - Unsupported "G.j": variable is an input variable. + - Unsupported "g.j": variable is an input variable. + - Unsupported "i": variable is an input variable. -- GitLab From fa7c67450f13ea04fcf63274b44fa89ead58a5cb Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 18 Sep 2022 22:43:00 +0200 Subject: [PATCH 19/51] #347 Move common Eclipse theme functionality to app framework for reuse. --- .../META-INF/MANIFEST.MF | 4 +- .../EclipseThemePreferenceChangeListener.java | 57 +++++++++++++++++++ .../eclipse/themes/EclipseThemeUtils.java | 55 ++++++++++++++++++ 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 common/org.eclipse.escet.common.app.framework/src/org/eclipse/escet/common/app/framework/eclipse/themes/EclipseThemePreferenceChangeListener.java create mode 100644 common/org.eclipse.escet.common.app.framework/src/org/eclipse/escet/common/app/framework/eclipse/themes/EclipseThemeUtils.java diff --git a/common/org.eclipse.escet.common.app.framework/META-INF/MANIFEST.MF b/common/org.eclipse.escet.common.app.framework/META-INF/MANIFEST.MF index 87f2cc72e..7998b5f29 100644 --- a/common/org.eclipse.escet.common.app.framework/META-INF/MANIFEST.MF +++ b/common/org.eclipse.escet.common.app.framework/META-INF/MANIFEST.MF @@ -17,9 +17,11 @@ Require-Bundle: org.eclipse.escet.common.java;bundle-version="0.7.0", org.eclipse.ui.console;bundle-version="3.9.0", org.eclipse.ui;bundle-version="3.115.0", org.apache.commons.io;bundle-version="2.6.0", - org.eclipse.jdt.core;bundle-version="3.25.0" + org.eclipse.jdt.core;bundle-version="3.25.0", + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.13.0" Export-Package: org.eclipse.escet.common.app.framework, org.eclipse.escet.common.app.framework.console, + org.eclipse.escet.common.app.framework.eclipse.themes, org.eclipse.escet.common.app.framework.exceptions, org.eclipse.escet.common.app.framework.io, org.eclipse.escet.common.app.framework.javacompiler, diff --git a/common/org.eclipse.escet.common.app.framework/src/org/eclipse/escet/common/app/framework/eclipse/themes/EclipseThemePreferenceChangeListener.java b/common/org.eclipse.escet.common.app.framework/src/org/eclipse/escet/common/app/framework/eclipse/themes/EclipseThemePreferenceChangeListener.java new file mode 100644 index 000000000..e0c9af0d5 --- /dev/null +++ b/common/org.eclipse.escet.common.app.framework/src/org/eclipse/escet/common/app/framework/eclipse/themes/EclipseThemePreferenceChangeListener.java @@ -0,0 +1,57 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.common.app.framework.eclipse.themes; + +import java.util.function.Consumer; + +import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; + +/** Eclipse theme preference change listener. */ +public class EclipseThemePreferenceChangeListener implements IPreferenceChangeListener { + /** The callback to invoke when the Eclipse theme preference changes. */ + private final Consumer callback; + + /** + * Constructor for the {@link EclipseThemePreferenceChangeListener} class. + * + *

+ * Both creates and registers the listener. + *

+ * + * @param callback The callback to invoke when the Eclipse theme preference changes. + */ + public EclipseThemePreferenceChangeListener(Consumer callback) { + this.callback = callback; + register(); + } + + @Override + public void preferenceChange(PreferenceChangeEvent event) { + // Handle Eclipse theme preference change. + if (event.getKey().equals("themeid")) { + callback.accept(event); + } + } + + /** Registers this Eclipse theme preference change listener. */ + private void register() { + EclipseThemeUtils.getEclipseThemePreferences().addPreferenceChangeListener(this); + } + + /** Unregisters this Eclipse theme preference change listener. */ + public void unregister() { + EclipseThemeUtils.getEclipseThemePreferences().removePreferenceChangeListener(this); + } +} diff --git a/common/org.eclipse.escet.common.app.framework/src/org/eclipse/escet/common/app/framework/eclipse/themes/EclipseThemeUtils.java b/common/org.eclipse.escet.common.app.framework/src/org/eclipse/escet/common/app/framework/eclipse/themes/EclipseThemeUtils.java new file mode 100644 index 000000000..8479b17c7 --- /dev/null +++ b/common/org.eclipse.escet.common.app.framework/src/org/eclipse/escet/common/app/framework/eclipse/themes/EclipseThemeUtils.java @@ -0,0 +1,55 @@ +////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2022 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available +// under the terms of the MIT License which is available at +// https://opensource.org/licenses/MIT +// +// SPDX-License-Identifier: MIT +////////////////////////////////////////////////////////////////////////////// + +package org.eclipse.escet.common.app.framework.eclipse.themes; + +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine; +import org.eclipse.e4.ui.css.swt.theme.ITheme; +import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; +import org.eclipse.ui.PlatformUI; + +/** Eclipse theme utility methods. */ +@SuppressWarnings("restriction") +public class EclipseThemeUtils { + /** Constructor for the {@link EclipseThemeUtils} class. */ + private EclipseThemeUtils() { + // Static class. + } + + /** + * Returns whether the current Eclipse theme is a dark theme. + * + *

+ * This method only recognizes and supports built-in Eclipse themes. Any custom dark theme will thus not be detected + * as a dark theme. + *

+ * + * @return {@code true} if the current Eclipse theme is a dark theme, {@code false} otherwise. + */ + public static boolean isDarkThemeInUse() { + IThemeEngine themeEngine = PlatformUI.getWorkbench().getService(IThemeEngine.class); + ITheme theme = themeEngine.getActiveTheme(); + return theme != null && theme.getId().equals(ThemeEngine.E4_DARK_THEME_ID); + } + + /** + * Returns the Eclipse theme preferences. + * + * @return The Eclipse theme preferences. + */ + public static IEclipsePreferences getEclipseThemePreferences() { + return InstanceScope.INSTANCE.getNode(ThemeEngine.THEME_PLUGIN_ID); + } +} -- GitLab From 0b33c3c9d75645db47e1b49c6f5808f4b7434f6d Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Sun, 18 Sep 2022 22:45:25 +0200 Subject: [PATCH 20/51] #347 Use common Eclipse theme functionality for text editors. --- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 3 +- .../META-INF/MANIFEST.MF | 3 +- .../texteditorbase/GenericTextEditor.java | 47 +++++++------------ .../themes/AutoDarkLightTheme.java | 19 +------- .../META-INF/MANIFEST.MF | 3 +- 7 files changed, 27 insertions(+), 54 deletions(-) diff --git a/chi/org.eclipse.escet.chi.texteditor/META-INF/MANIFEST.MF b/chi/org.eclipse.escet.chi.texteditor/META-INF/MANIFEST.MF index e9a2574f0..87783255f 100644 --- a/chi/org.eclipse.escet.chi.texteditor/META-INF/MANIFEST.MF +++ b/chi/org.eclipse.escet.chi.texteditor/META-INF/MANIFEST.MF @@ -18,6 +18,7 @@ Require-Bundle: org.eclipse.escet.chi.parser;bundle-version="0.7.0", org.eclipse.escet.setext.texteditorbase;bundle-version="0.7.0", org.eclipse.escet.setext.runtime;bundle-version="0.7.0", org.eclipse.escet.common.java;bundle-version="0.7.0", - org.eclipse.ui.ide;bundle-version="3.18.200" + org.eclipse.ui.ide;bundle-version="3.18.200", + org.eclipse.escet.common.app.framework;bundle-version="0.7.0" Automatic-Module-Name: org.eclipse.escet.chi.texteditor Export-Package: org.eclipse.escet.chi.texteditor diff --git a/cif/org.eclipse.escet.cif.texteditor/META-INF/MANIFEST.MF b/cif/org.eclipse.escet.cif.texteditor/META-INF/MANIFEST.MF index 723a94101..fdd681135 100644 --- a/cif/org.eclipse.escet.cif.texteditor/META-INF/MANIFEST.MF +++ b/cif/org.eclipse.escet.cif.texteditor/META-INF/MANIFEST.MF @@ -20,6 +20,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.17.0", org.eclipse.escet.setext.runtime;bundle-version="0.7.0", org.apache.commons.lang3;bundle-version="3.1.0", org.eclipse.escet.setext.texteditorbase;bundle-version="0.7.0", - org.eclipse.ui.ide;bundle-version="3.18.200" + org.eclipse.ui.ide;bundle-version="3.18.200", + org.eclipse.escet.common.app.framework;bundle-version="0.7.0" Export-Package: org.eclipse.escet.cif.texteditor Automatic-Module-Name: org.eclipse.escet.cif.texteditor diff --git a/setext/org.eclipse.escet.setext.texteditor/META-INF/MANIFEST.MF b/setext/org.eclipse.escet.setext.texteditor/META-INF/MANIFEST.MF index 535bf6490..c79ddd856 100644 --- a/setext/org.eclipse.escet.setext.texteditor/META-INF/MANIFEST.MF +++ b/setext/org.eclipse.escet.setext.texteditor/META-INF/MANIFEST.MF @@ -18,6 +18,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.17.0", org.eclipse.escet.setext.runtime;bundle-version="0.7.0", org.eclipse.escet.setext.texteditorbase;bundle-version="0.7.0", org.junit;bundle-version="4.12.0", - org.eclipse.ui.ide;bundle-version="3.18.200" + org.eclipse.ui.ide;bundle-version="3.18.200", + org.eclipse.escet.common.app.framework;bundle-version="0.7.0" Export-Package: org.eclipse.escet.setext.texteditor Automatic-Module-Name: org.eclipse.escet.setext.texteditor diff --git a/setext/org.eclipse.escet.setext.texteditorbase/META-INF/MANIFEST.MF b/setext/org.eclipse.escet.setext.texteditorbase/META-INF/MANIFEST.MF index 3cdaef49e..c8e89cf13 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/META-INF/MANIFEST.MF +++ b/setext/org.eclipse.escet.setext.texteditorbase/META-INF/MANIFEST.MF @@ -28,6 +28,5 @@ Require-Bundle: org.eclipse.swt;bundle-version="3.113.0", org.eclipse.ui.workbench.texteditor;bundle-version="3.14.0", org.eclipse.core.commands;bundle-version="3.9.600", org.eclipse.ui.workbench;bundle-version="3.117.0", - org.apache.commons.lang3;bundle-version="3.1.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.13.0" + org.apache.commons.lang3;bundle-version="3.1.0" Automatic-Module-Name: org.eclipse.escet.setext.texteditorbase diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java index 882b6eeae..0f870b11d 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java @@ -33,11 +33,9 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; -import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.escet.common.app.framework.AppEnv; +import org.eclipse.escet.common.app.framework.eclipse.themes.EclipseThemePreferenceChangeListener; import org.eclipse.escet.common.app.framework.options.Options; import org.eclipse.escet.common.app.framework.output.OutputMode; import org.eclipse.escet.common.app.framework.output.OutputModeOption; @@ -96,7 +94,7 @@ import org.eclipse.ui.texteditor.MarkerUtilities; * @param The enum with the named styles of the text editor. */ public class GenericTextEditor> extends TextEditor - implements IDocumentListener, IPartListener, IPreferenceChangeListener + implements IDocumentListener, IPartListener { /** Whether to print debugging information related to validation timing. */ private static final boolean DEBUG_TIMING = false; @@ -137,6 +135,9 @@ public class GenericTextEditor> extends TextEditor /** The light theme for the text editor. */ private final TextEditorTheme lightTheme; + /** The Eclipse theme preference change listener. */ + private final EclipseThemePreferenceChangeListener themeListener; + /** The SeText generated parser class to use for parsing, or {@code null} if no parser is available. */ private final Class> parserClass; @@ -201,7 +202,7 @@ public class GenericTextEditor> extends TextEditor GenericSourceViewerConfiguration sourceViewerConfig = createThemedSourceViewerConfig(configuredTheme); setSourceViewerConfiguration(sourceViewerConfig); - registerThemePreferenceChangeListener(); + this.themeListener = new EclipseThemePreferenceChangeListener(this::handleThemeChange); } @Override @@ -439,29 +440,14 @@ public class GenericTextEditor> extends TextEditor super.handlePreferenceStoreChanged(event); } - @Override - public void preferenceChange(PreferenceChangeEvent event) { - // Handle Eclipse theme preference change. - if (event.getKey().equals("themeid")) { - TextEditorTheme theme = getConfiguredTheme(); - retheme(theme); - } - } - - /** Registers this text editor as theme-related preference change listener. */ - private void registerThemePreferenceChangeListener() { - @SuppressWarnings("restriction") - IEclipsePreferences preferences = InstanceScope.INSTANCE - .getNode(org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.THEME_PLUGIN_ID); - preferences.addPreferenceChangeListener(this); - } - - /** Unregisters this text editor as theme-related preference change listener. */ - private void unregisterThemePreferenceChangeListener() { - @SuppressWarnings("restriction") - IEclipsePreferences preferences = InstanceScope.INSTANCE - .getNode(org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.THEME_PLUGIN_ID); - preferences.removePreferenceChangeListener(this); + /** + * Handle Eclipse theme preference change. + * + * @param event The theme preference change event. + */ + private void handleThemeChange(PreferenceChangeEvent event) { + TextEditorTheme theme = getConfiguredTheme(); + retheme(theme); } @Override @@ -929,9 +915,8 @@ public class GenericTextEditor> extends TextEditor IPartService ps = getSite().getWorkbenchWindow().getPartService(); ps.removePartListener(this); - // Unregister theme-related preference change listener if this editor - // is closed, to allow garbage collection of this editor. - unregisterThemePreferenceChangeListener(); + // Unregister theme-related preference change listener. + themeListener.unregister(); // Save folding state. Fails if the file no longer exists, for instance // because it has been renamed. However, failures are ignored, so it's diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java index f93095d81..3819e3770 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java @@ -13,11 +13,8 @@ package org.eclipse.escet.setext.texteditorbase.themes; -import org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine; -import org.eclipse.e4.ui.css.swt.theme.ITheme; -import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; +import org.eclipse.escet.common.app.framework.eclipse.themes.EclipseThemeUtils; import org.eclipse.escet.setext.texteditorbase.Style; -import org.eclipse.ui.PlatformUI; /** * A text editor that automatically uses a dark theme or light theme, depending on the theme currently used by Eclipse. @@ -29,7 +26,6 @@ import org.eclipse.ui.PlatformUI; * * @param The enum with the named styles of a text editor. */ -@SuppressWarnings("restriction") public class AutoDarkLightTheme implements TextEditorTheme { /** The dark or light theme to use. */ private final TextEditorTheme theme; @@ -41,18 +37,7 @@ public class AutoDarkLightTheme implements TextEditorTheme { * @param lightTheme The light them to use. */ public AutoDarkLightTheme(TextEditorTheme darkTheme, TextEditorTheme lightTheme) { - theme = isDarkThemeInUse() ? darkTheme : lightTheme; - } - - /** - * Returns whether the current Eclipse theme is a dark theme. - * - * @return {@code true} if the current Eclipse theme is a dark theme, {@code false} otherwise. - */ - private boolean isDarkThemeInUse() { - IThemeEngine themeEngine = PlatformUI.getWorkbench().getService(IThemeEngine.class); - ITheme theme = themeEngine.getActiveTheme(); - return theme != null && theme.getId().equals(ThemeEngine.E4_DARK_THEME_ID); + theme = EclipseThemeUtils.isDarkThemeInUse() ? darkTheme : lightTheme; } @Override diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/META-INF/MANIFEST.MF b/tooldef/org.eclipse.escet.tooldef.texteditor/META-INF/MANIFEST.MF index 05f0702ab..041920710 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/META-INF/MANIFEST.MF +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/META-INF/MANIFEST.MF @@ -19,6 +19,7 @@ Require-Bundle: org.eclipse.escet.tooldef.metamodel;bundle-version="0.7.0", org.eclipse.escet.common.java;bundle-version="0.7.0", org.apache.commons.lang3;bundle-version="3.1.0", org.eclipse.escet.tooldef.typechecker;bundle-version="0.7.0", - org.eclipse.ui.ide;bundle-version="3.18.200" + org.eclipse.ui.ide;bundle-version="3.18.200", + org.eclipse.escet.common.app.framework;bundle-version="0.7.0" Automatic-Module-Name: org.eclipse.escet.tooldef.texteditor Export-Package: org.eclipse.escet.tooldef.texteditor -- GitLab From 8167f6d5f4d391780b262561e08bd0ab60d65115 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Thu, 22 Sep 2022 20:48:54 +0200 Subject: [PATCH 21/51] #398 SequenceMessage automagic space handling. - No need to put spaces before/after each literal message. - Handles optional message parts automagically as well. --- .../cif/common/checkers/CifCheckViolations.java | 3 ++- .../checkers/checks/AutNoKindlessCheck.java | 2 +- .../checks/AutOnlyWithOneInitLocCheck.java | 10 +++++----- .../checkers/checks/CompNoInitPredsCheck.java | 2 +- .../CompOnlyVarValueMarkerPredsCheck.java | 4 ++-- .../checks/CompStateInvsOnlyReqsCheck.java | 2 +- .../checkers/checks/EdgeNoIfUpdatesCheck.java | 2 +- .../checkers/checks/EdgeNoMultiAssignCheck.java | 2 +- .../checks/EdgeNoPartialVarAssignCheck.java | 2 +- .../checkers/checks/EdgeNoUrgentCheck.java | 2 +- .../checkers/checks/EventNoChannelsCheck.java | 2 +- .../common/checkers/checks/EventNoTauCheck.java | 4 ++-- .../EventOnlyWithControllabilityCheck.java | 6 +++--- .../checks/InvNoKindlessStateEvtExclCheck.java | 6 +++--- .../checkers/checks/LocNoStateInvsCheck.java | 4 ++-- .../checkers/checks/LocNoUrgentCheck.java | 2 +- .../LocOnlyStaticEvalMarkerPredsCheck.java | 12 ++++++------ .../checkers/messages/SequenceMessage.java | 17 ++++++++++++++--- 18 files changed, 48 insertions(+), 36 deletions(-) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java index 91e25e979..236b7c48f 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java @@ -60,7 +60,8 @@ public class CifCheckViolations { *
  • To report a violation on an entire specification, either a {@link Specification} or {@code null} may be * provided.
  • * - * @param messages The non-empty sequence of concatenated messages describing the violation. + * @param messages The non-empty sequence of concatenated messages describing the violation. The messages are + * trimmed and concatenated, with a space being added in between each two messages if needed. * @see CifCheckViolation#CifCheckViolation */ public void add(PositionObject cifObject, CifCheckViolationMessage... messages) { diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java index 44f8f2e64..8517cbbd5 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java @@ -26,7 +26,7 @@ public class AutNoKindlessCheck extends CifCheck { protected void preprocessAutomaton(Automaton aut, CifCheckViolations violations) { if (aut.getKind() == SupKind.NONE) { violations.add(aut, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" is a kindless automaton, lacking a supervisory kind")); + new LiteralMessage("is a kindless automaton, lacking a supervisory kind")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java index 4807ce5c9..a909e6e69 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java @@ -50,10 +50,10 @@ public class AutOnlyWithOneInitLocCheck extends CifCheck { // There must be exactly one initial location. if (initLocCount == 0) { violations.add(aut, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" has no initial location")); + new LiteralMessage("has no initial location")); } else if (initLocCount > 1) { violations.add(aut, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(fmt(" has multiple (%d) initial locations", initLocCount))); + new LiteralMessage(fmt("has multiple (%d) initial locations", initLocCount))); } // Skip if check is disabled (negative value). } @@ -80,9 +80,9 @@ public class AutOnlyWithOneInitLocCheck extends CifCheck { } if (errMsg != null) { // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new LiteralMessage("failed to determine whether the "), - new IfReportOnAncestorMessage("automaton's "), - new LiteralMessage("location is an initial location, " + errMsg)); + violations.add(loc, new LiteralMessage("failed to determine whether the"), + new IfReportOnAncestorMessage("automaton's"), + new LiteralMessage("location is an initial location,"), new LiteralMessage(errMsg)); // Disable initial location count checking. initLocCount = -1; diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java index c8f178f97..3fd9d0540 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java @@ -28,7 +28,7 @@ public class CompNoInitPredsCheck extends CifCheck { protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { if (!comp.getInitials().isEmpty()) { violations.add(comp, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" contains an initialization predicate")); + new LiteralMessage("contains an initialization predicate")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java index be6bb1250..dee21df48 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java @@ -42,13 +42,13 @@ public class CompOnlyVarValueMarkerPredsCheck extends CifCheck { // The only supported form is 'discrete_variable = marked_value'. if (!(marked instanceof BinaryExpression)) { violations.add(comp, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( - " has a marker predicate that is not of the form \"discrete_variable = marked_value\"")); + "has a marker predicate that is not of the form \"discrete_variable = marked_value\"")); continue; } BinaryExpression bexpr = (BinaryExpression)marked; if (bexpr.getOperator() != BinaryOperator.EQUAL || !(bexpr.getLeft() instanceof DiscVariableExpression)) { violations.add(comp, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( - " has a marker predicate that is not of the form \"discrete_variable = marked_value\"")); + "has a marker predicate that is not of the form \"discrete_variable = marked_value\"")); continue; } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java index bb80b7395..1197b5beb 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java @@ -35,7 +35,7 @@ public class CompStateInvsOnlyReqsCheck extends CifCheck { if (supKind != SupKind.REQUIREMENT) { String kindTxt = (supKind == SupKind.NONE) ? "kindless" : CifTextUtils.kindToStr(supKind); violations.add(comp, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(fmt(" has a %s state invariant", kindTxt))); + new LiteralMessage(fmt("has a %s state invariant", kindTxt))); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java index d43e769d0..8ff3f9129 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java @@ -29,6 +29,6 @@ public class EdgeNoIfUpdatesCheck extends CifCheck { protected void preprocessIfUpdate(IfUpdate update, CifCheckViolations violations) { // Report violation on the closest named ancestor of the 'if' update: a location or an automaton. violations.add(update, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" has an edge with an 'if' update")); + new LiteralMessage("has an edge with an 'if' update")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java index b5c2a9bd5..3b68a665a 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java @@ -32,7 +32,7 @@ public class EdgeNoMultiAssignCheck extends CifCheck { if (asgn.getAddressable() instanceof TupleExpression) { // Report violation on the closest named ancestor of the assignment: a location or an automaton. violations.add(asgn, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" has an edge with a multi-assignment")); + new LiteralMessage("has an edge with a multi-assignment")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java index 5e0cc8ffe..963a044cc 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java @@ -31,7 +31,7 @@ public class EdgeNoPartialVarAssignCheck extends CifCheck { if (asgn.getAddressable() instanceof ProjectionExpression) { // Report violation on the closest named ancestor of the assignment: a location or an automaton. violations.add(asgn, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" has an edge with a partial variable assignment")); + new LiteralMessage("has an edge with a partial variable assignment")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java index f21b827e7..6824a7bfe 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java @@ -25,7 +25,7 @@ public class EdgeNoUrgentCheck extends CifCheck { protected void preprocessEdge(Edge edge, CifCheckViolations violations) { if (edge.isUrgent()) { // Report violation on the closest named ancestor of the edge: a location or an automaton. - violations.add(edge, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has an urgent edge")); + violations.add(edge, new ReportObjectTypeDescriptionMessage(), new LiteralMessage("has an urgent edge")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java index e692fdc83..272336651 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java @@ -25,7 +25,7 @@ public class EventNoChannelsCheck extends CifCheck { protected void preprocessEvent(Event event, CifCheckViolations violations) { if (event.getType() != null) { violations.add(event, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" is a channel (has a data type)")); + new LiteralMessage("is a channel (has a data type)")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java index 92dea8aa9..539bda87e 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java @@ -31,7 +31,7 @@ public class EventNoTauCheck extends CifCheck { // Explicit tau. // Report violation on the closest named ancestor of the tau expression: a location or an automaton. violations.add(tauExpr, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" has an edge with explicitly event \"tau\" on it")); + new LiteralMessage("has an edge with explicitly event \"tau\" on it")); } @Override @@ -40,7 +40,7 @@ public class EventNoTauCheck extends CifCheck { if (edge.getEvents().isEmpty()) { // Report violation on the closest named ancestor of the edge: a location or an automaton. violations.add(edge, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" has an edge with implicitly event \"tau\" on it")); + new LiteralMessage("has an edge with implicitly event \"tau\" on it")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java index deb169639..0b82524c9 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java @@ -31,7 +31,7 @@ public class EventOnlyWithControllabilityCheck extends CifCheck { protected void preprocessEvent(Event event, CifCheckViolations violations) { if (event.getControllable() == null) { violations.add(event, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(" is not declared as controllable or uncontrollable")); + new LiteralMessage("is not declared as controllable or uncontrollable")); } } @@ -40,7 +40,7 @@ public class EventOnlyWithControllabilityCheck extends CifCheck { // Explicit tau. // Report violation on the closest named ancestor of the tau expression: a location or an automaton. violations.add(tauExpr, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( - " has an edge with explicitly event \"tau\" on it, which is not controllable or uncontrollable")); + "has an edge with explicitly event \"tau\" on it, which is not controllable or uncontrollable")); } @Override @@ -49,7 +49,7 @@ public class EventOnlyWithControllabilityCheck extends CifCheck { if (edge.getEvents().isEmpty()) { // Report violation on the closest named ancestor of the edge: a location or an automaton. violations.add(edge, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( - " has an edge with implicitly event \"tau\" on it, which is not controllable or uncontrollable")); + "has an edge with implicitly event \"tau\" on it, which is not controllable or uncontrollable")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java index 453f8dc18..b755e0c5c 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java @@ -31,9 +31,9 @@ public class InvNoKindlessStateEvtExclCheck extends CifCheck { SupKind supKind = inv.getSupKind(); if (supKind == SupKind.NONE) { // The closest named ancestor of the invariant is the invariant itself, or a location or a component. - violations.add(inv, new ReportObjectTypeDescriptionMessage(), new IfReportOnAncestorMessage(" has"), - new IfReportOnSelfMessage(" is"), - new LiteralMessage(" a kindless state/event exclusion invariant, lacking a supervisory kind")); + violations.add(inv, new ReportObjectTypeDescriptionMessage(), new IfReportOnAncestorMessage("has"), + new IfReportOnSelfMessage("is"), + new LiteralMessage("a kindless state/event exclusion invariant, lacking a supervisory kind")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java index 457afad57..25e7c3382 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java @@ -30,8 +30,8 @@ public class LocNoStateInvsCheck extends CifCheck { for (Invariant inv: loc.getInvariants()) { if (inv.getInvKind() == InvKind.STATE) { // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has"), - new IfReportOnAncestorMessage(" a location with"), new LiteralMessage(" a state invariant")); + violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage("has"), + new IfReportOnAncestorMessage("a location with"), new LiteralMessage("a state invariant")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java index a8ecba3b5..23b684a8a 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java @@ -28,7 +28,7 @@ public class LocNoUrgentCheck extends CifCheck { if (loc.isUrgent()) { // Report violation on the location, or on its automaton in case the location has no name. violations.add(loc, new ReportObjectTypeDescriptionMessage(), - new IfReportOnAncestorMessage(" has an urgent location"), new IfReportOnSelfMessage(" is urgent")); + new IfReportOnAncestorMessage("has an urgent location"), new IfReportOnSelfMessage("is urgent")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java index b53eb4977..5c70216a1 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java @@ -34,14 +34,14 @@ public class LocOnlyStaticEvalMarkerPredsCheck extends CifCheck { evalPreds(loc.getMarkeds(), false, true); } catch (UnsupportedException e) { // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has"), - new IfReportOnAncestorMessage(" a location with"), - new LiteralMessage(" a marker predicate that can not be evaluated statically")); + violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage("has"), + new IfReportOnAncestorMessage("a location with"), + new LiteralMessage("a marker predicate that can not be evaluated statically")); } catch (CifEvalException e) { // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage(" has"), - new IfReportOnAncestorMessage(" a location with"), - new LiteralMessage(" a marker predicate that can not be evaluated statically, " + violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage("has"), + new IfReportOnAncestorMessage("a location with"), + new LiteralMessage("a marker predicate that can not be evaluated statically, " + "as the evaluation resulted in an evaluation error")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java index 6634375c4..14465df78 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java @@ -14,7 +14,6 @@ package org.eclipse.escet.cif.common.checkers.messages; import java.util.List; -import java.util.stream.Collectors; import org.eclipse.escet.cif.common.checkers.CifCheckViolation; import org.eclipse.escet.common.java.Assert; @@ -27,7 +26,8 @@ public class SequenceMessage extends CifCheckViolationMessage { /** * Constructor for the {@link SequenceMessage} class. * - * @param messages The non-empty sequence of messages. + * @param messages The non-empty sequence of messages. The messages are trimmed and concatenated, with a space being + * added in between each two messages if needed. */ public SequenceMessage(List messages) { Assert.check(!messages.isEmpty()); @@ -36,7 +36,18 @@ public class SequenceMessage extends CifCheckViolationMessage { @Override public String getMessage(CifCheckViolation violation) { - return messages.stream().map(m -> m.getMessage(violation)).collect(Collectors.joining()); + StringBuilder text = new StringBuilder(); + for (CifCheckViolationMessage message: messages) { + String messageText = message.getMessage(violation); + messageText = messageText.trim(); + if (!messageText.isEmpty()) { // Only add if not empty. + if (text.length() > 0) { // Add separator if there is any text already present. + text.append(" "); + } + text.append(messageText); + } + } + return text.toString(); } @Override -- GitLab From 1940997e691286ca7af3ae7e0021bbc97524a700 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Thu, 22 Sep 2022 21:03:31 +0200 Subject: [PATCH 22/51] #398 LiteralMessage/IfReport...Message support format patterns. --- .../checkers/checks/AutOnlyWithOneInitLocCheck.java | 3 +-- .../checkers/checks/CompStateInvsOnlyReqsCheck.java | 4 +--- .../checks/ExprNoSpecificBinaryExprsCheck.java | 9 ++++----- .../checkers/checks/ExprNoSpecificExprsCheck.java | 3 +-- .../checks/ExprNoSpecificUnaryExprsCheck.java | 10 ++++------ .../checkers/checks/TypeNoSpecificTypesCheck.java | 3 +-- .../checks/VarNoDiscWithMultiInitValuesCheck.java | 4 +--- .../checkers/messages/IfReportOnAncestorMessage.java | 10 +++++++--- .../checkers/messages/IfReportOnSelfMessage.java | 9 ++++++--- .../cif/common/checkers/messages/LiteralMessage.java | 11 ++++++++--- 10 files changed, 34 insertions(+), 32 deletions(-) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java index a909e6e69..d6784b157 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java @@ -14,7 +14,6 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifEvalUtils.evalPreds; -import static org.eclipse.escet.common.java.Strings.fmt; import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.CifEvalException; @@ -53,7 +52,7 @@ public class AutOnlyWithOneInitLocCheck extends CifCheck { new LiteralMessage("has no initial location")); } else if (initLocCount > 1) { violations.add(aut, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(fmt("has multiple (%d) initial locations", initLocCount))); + new LiteralMessage("has multiple (%d) initial locations", initLocCount)); } // Skip if check is disabled (negative value). } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java index 1197b5beb..58bc65268 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java @@ -13,8 +13,6 @@ package org.eclipse.escet.cif.common.checkers.checks; -import static org.eclipse.escet.common.java.Strings.fmt; - import org.eclipse.escet.cif.common.CifTextUtils; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; @@ -35,7 +33,7 @@ public class CompStateInvsOnlyReqsCheck extends CifCheck { if (supKind != SupKind.REQUIREMENT) { String kindTxt = (supKind == SupKind.NONE) ? "kindless" : CifTextUtils.kindToStr(supKind); violations.add(comp, new ReportObjectTypeDescriptionMessage(), - new LiteralMessage(fmt("has a %s state invariant", kindTxt))); + new LiteralMessage("has a %s state invariant", kindTxt)); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificBinaryExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificBinaryExprsCheck.java index a66394aef..48d342b31 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificBinaryExprsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificBinaryExprsCheck.java @@ -16,7 +16,6 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; import static org.eclipse.escet.cif.common.CifTextUtils.operatorToStr; import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; -import static org.eclipse.escet.common.java.Strings.fmt; import java.util.Arrays; import java.util.EnumSet; @@ -426,8 +425,8 @@ public class ExprNoSpecificBinaryExprsCheck extends CifCheck { * @param violations The violations collected so far. Is modified in-place. */ private void addExprViolationOperator(BinaryExpression binExpr, CifCheckViolations violations) { - violations.add(binExpr, new LiteralMessage(fmt("uses binary operator \"%s\" in binary expression \"%s\"", - operatorToStr(binExpr.getOperator()), exprToStr(binExpr)))); + violations.add(binExpr, new LiteralMessage("uses binary operator \"%s\" in binary expression \"%s\"", + operatorToStr(binExpr.getOperator()), exprToStr(binExpr))); } /** @@ -440,8 +439,8 @@ public class ExprNoSpecificBinaryExprsCheck extends CifCheck { CifType ltype = CifTypeUtils.normalizeType(binExpr.getLeft().getType()); CifType rtype = CifTypeUtils.normalizeType(binExpr.getRight().getType()); violations.add(binExpr, new LiteralMessage( - fmt("uses binary operator \"%s\" on operands of types \"%s\" and \"%s\" in binary expression \"%s\"", - operatorToStr(binExpr.getOperator()), typeToStr(ltype), typeToStr(rtype), exprToStr(binExpr)))); + "uses binary operator \"%s\" on operands of types \"%s\" and \"%s\" in binary expression \"%s\"", + operatorToStr(binExpr.getOperator()), typeToStr(ltype), typeToStr(rtype), exprToStr(binExpr))); } /** The binary operator, or binary operator operating on certain operand types, to disallow. */ diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificExprsCheck.java index dcd384f22..eb860a3a6 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificExprsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificExprsCheck.java @@ -14,7 +14,6 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; -import static org.eclipse.escet.common.java.Strings.fmt; import java.util.Arrays; import java.util.EnumSet; @@ -388,7 +387,7 @@ public class ExprNoSpecificExprsCheck extends CifCheck { * @param violations The violations collected so far. Is modified in-place. */ private void addExprViolation(Expression expr, String description, CifCheckViolations violations) { - violations.add(expr, new LiteralMessage(fmt("uses %s \"%s\"", description, exprToStr(expr)))); + violations.add(expr, new LiteralMessage("uses %s \"%s\"", description, exprToStr(expr))); } /** The expression to disallow. */ diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificUnaryExprsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificUnaryExprsCheck.java index ecdfc0e5e..1a23527ca 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificUnaryExprsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/ExprNoSpecificUnaryExprsCheck.java @@ -16,7 +16,6 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifTextUtils.exprToStr; import static org.eclipse.escet.cif.common.CifTextUtils.operatorToStr; import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; -import static org.eclipse.escet.common.java.Strings.fmt; import java.util.Arrays; import java.util.EnumSet; @@ -131,8 +130,8 @@ public class ExprNoSpecificUnaryExprsCheck extends CifCheck { * @param violations The violations collected so far. Is modified in-place. */ private void addExprViolationOperator(UnaryExpression unExpr, CifCheckViolations violations) { - violations.add(unExpr, new LiteralMessage(fmt("uses unary operator \"%s\" in unary expression \"%s\"", - operatorToStr(unExpr.getOperator()), exprToStr(unExpr)))); + violations.add(unExpr, new LiteralMessage("uses unary operator \"%s\" in unary expression \"%s\"", + operatorToStr(unExpr.getOperator()), exprToStr(unExpr))); } /** @@ -144,9 +143,8 @@ public class ExprNoSpecificUnaryExprsCheck extends CifCheck { private void addExprViolationOperand(UnaryExpression unExpr, CifCheckViolations violations) { CifType ctype = CifTypeUtils.normalizeType(unExpr.getChild().getType()); violations.add(unExpr, - new LiteralMessage( - fmt("uses unary operator \"%s\" on an operand of type \"%s\" in unary expression \"%s\"", - operatorToStr(unExpr.getOperator()), typeToStr(ctype), exprToStr(unExpr)))); + new LiteralMessage("uses unary operator \"%s\" on an operand of type \"%s\" in unary expression \"%s\"", + operatorToStr(unExpr.getOperator()), typeToStr(ctype), exprToStr(unExpr))); } /** The unary operator, or unary operator operating on certain operand types, to disallow. */ diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/TypeNoSpecificTypesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/TypeNoSpecificTypesCheck.java index 0fa13c3b6..311f9b58f 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/TypeNoSpecificTypesCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/TypeNoSpecificTypesCheck.java @@ -14,7 +14,6 @@ package org.eclipse.escet.cif.common.checkers.checks; import static org.eclipse.escet.cif.common.CifTextUtils.typeToStr; -import static org.eclipse.escet.common.java.Strings.fmt; import java.util.Arrays; import java.util.EnumSet; @@ -164,7 +163,7 @@ public class TypeNoSpecificTypesCheck extends CifCheck { * @param violations The violations collected so far. Is modified in-place. */ private void addTypeViolation(CifType type, String description, CifCheckViolations violations) { - violations.add(type, new LiteralMessage(fmt("uses %s \"%s\"", description, typeToStr(type)))); + violations.add(type, new LiteralMessage("uses %s \"%s\"", description, typeToStr(type))); } /** The type, or sub-type, to disallow. */ diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java index 9fe37bb08..881eb3ea5 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java @@ -13,8 +13,6 @@ package org.eclipse.escet.cif.common.checkers.checks; -import static org.eclipse.escet.common.java.Strings.fmt; - import org.eclipse.emf.ecore.EObject; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; @@ -44,7 +42,7 @@ public class VarNoDiscWithMultiInitValuesCheck extends CifCheck { "discrete variable has multiple potential initial values (any value in its domain)")); } else if (count > 1) { violations.add(var, - new LiteralMessage(fmt("discrete variable has multiple (%d) potential initial values", count))); + new LiteralMessage("discrete variable has multiple (%d) potential initial values", count)); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java index c8f3748d5..0860f4772 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java @@ -14,6 +14,7 @@ package org.eclipse.escet.cif.common.checkers.messages; import org.eclipse.escet.cif.common.checkers.CifCheckViolation; +import org.eclipse.escet.common.java.Strings; /** * Message that is conditional on the violation being reported on an ancestor of the object, rather than on the object @@ -26,10 +27,13 @@ public class IfReportOnAncestorMessage extends CifCheckViolationMessage { /** * Constructor for the {@link IfReportOnAncestorMessage} class. * - * @param message The literal message to use if the violation is reported on an ancestor of the object. + * @param messagePattern The message format pattern, to use if the violation is reported on an ancestor of the + * object. + * @param args The message format arguments. + * @see Strings#fmt */ - public IfReportOnAncestorMessage(String message) { - this(new LiteralMessage(message)); + public IfReportOnAncestorMessage(String messagePattern, Object... args) { + this(new LiteralMessage(messagePattern, args)); } /** diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java index d4edf8046..93cff2447 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java @@ -14,6 +14,7 @@ package org.eclipse.escet.cif.common.checkers.messages; import org.eclipse.escet.cif.common.checkers.CifCheckViolation; +import org.eclipse.escet.common.java.Strings; /** * Message that is conditional on the violation being reported on the object itself, rather than on one of its @@ -26,10 +27,12 @@ public class IfReportOnSelfMessage extends CifCheckViolationMessage { /** * Constructor for the {@link IfReportOnSelfMessage} class. * - * @param message The literal message to use if the violation is reported on the object itself. + * @param messagePattern The message format pattern, to use if the violation is reported on the object itself. + * @param args The message format arguments. + * @see Strings#fmt */ - public IfReportOnSelfMessage(String message) { - this(new LiteralMessage(message)); + public IfReportOnSelfMessage(String messagePattern, Object... args) { + this(new LiteralMessage(messagePattern, args)); } /** diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java index e232cc843..e34f89e98 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java @@ -13,7 +13,10 @@ package org.eclipse.escet.cif.common.checkers.messages; +import static org.eclipse.escet.common.java.Strings.fmt; + import org.eclipse.escet.cif.common.checkers.CifCheckViolation; +import org.eclipse.escet.common.java.Strings; /** A literal message. */ public class LiteralMessage extends CifCheckViolationMessage { @@ -23,10 +26,12 @@ public class LiteralMessage extends CifCheckViolationMessage { /** * Constructor for the {@link LiteralMessage} class. * - * @param message The message. + * @param messagePattern The message format pattern. + * @param args The message format arguments. + * @see Strings#fmt */ - public LiteralMessage(String message) { - this.message = message; + public LiteralMessage(String messagePattern, Object... args) { + this.message = fmt(messagePattern, args); } @Override -- GitLab From 9424c5c9de9814a78f1d2617d17928ac950002e3 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Thu, 22 Sep 2022 21:06:46 +0200 Subject: [PATCH 23/51] #398 Small ReportObjectTypeDescriptionMessage improvements. - Shortened class name a little bit. - JavaDoc improvements to clarify the functionality. --- .../common/checkers/checks/AutNoKindlessCheck.java | 4 ++-- .../checkers/checks/AutOnlyWithOneInitLocCheck.java | 6 +++--- .../checkers/checks/CompNoInitPredsCheck.java | 4 ++-- .../checks/CompOnlyVarValueMarkerPredsCheck.java | 6 +++--- .../checkers/checks/CompStateInvsOnlyReqsCheck.java | 4 ++-- .../checkers/checks/EdgeNoIfUpdatesCheck.java | 4 ++-- .../checkers/checks/EdgeNoMultiAssignCheck.java | 4 ++-- .../checks/EdgeNoPartialVarAssignCheck.java | 4 ++-- .../common/checkers/checks/EdgeNoUrgentCheck.java | 4 ++-- .../checkers/checks/EventNoChannelsCheck.java | 4 ++-- .../cif/common/checkers/checks/EventNoTauCheck.java | 6 +++--- .../checks/EventOnlyWithControllabilityCheck.java | 8 ++++---- .../checks/InvNoKindlessStateEvtExclCheck.java | 4 ++-- .../common/checkers/checks/LocNoStateInvsCheck.java | 4 ++-- .../common/checkers/checks/LocNoUrgentCheck.java | 4 ++-- .../checks/LocOnlyStaticEvalMarkerPredsCheck.java | 6 +++--- ...ssage.java => ReportObjectTypeDescrMessage.java} | 13 +++++++++++-- 17 files changed, 49 insertions(+), 40 deletions(-) rename cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/{ReportObjectTypeDescriptionMessage.java => ReportObjectTypeDescrMessage.java} (71%) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java index 8517cbbd5..70ee46135 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutNoKindlessCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.SupKind; import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; @@ -25,7 +25,7 @@ public class AutNoKindlessCheck extends CifCheck { @Override protected void preprocessAutomaton(Automaton aut, CifCheckViolations violations) { if (aut.getKind() == SupKind.NONE) { - violations.add(aut, new ReportObjectTypeDescriptionMessage(), + violations.add(aut, new ReportObjectTypeDescrMessage(), new LiteralMessage("is a kindless automaton, lacking a supervisory kind")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java index d6784b157..1b9beab7b 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java @@ -21,7 +21,7 @@ import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.LocationParameter; import org.eclipse.escet.cif.metamodel.cif.automata.Automaton; import org.eclipse.escet.cif.metamodel.cif.automata.Location; @@ -48,10 +48,10 @@ public class AutOnlyWithOneInitLocCheck extends CifCheck { protected void postprocessAutomaton(Automaton aut, CifCheckViolations violations) { // There must be exactly one initial location. if (initLocCount == 0) { - violations.add(aut, new ReportObjectTypeDescriptionMessage(), + violations.add(aut, new ReportObjectTypeDescrMessage(), new LiteralMessage("has no initial location")); } else if (initLocCount > 1) { - violations.add(aut, new ReportObjectTypeDescriptionMessage(), + violations.add(aut, new ReportObjectTypeDescrMessage(), new LiteralMessage("has multiple (%d) initial locations", initLocCount)); } // Skip if check is disabled (negative value). } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java index 3fd9d0540..34e4fee0d 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompNoInitPredsCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; /** @@ -27,7 +27,7 @@ public class CompNoInitPredsCheck extends CifCheck { @Override protected void preprocessComplexComponent(ComplexComponent comp, CifCheckViolations violations) { if (!comp.getInitials().isEmpty()) { - violations.add(comp, new ReportObjectTypeDescriptionMessage(), + violations.add(comp, new ReportObjectTypeDescrMessage(), new LiteralMessage("contains an initialization predicate")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java index dee21df48..a69a4f675 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompOnlyVarValueMarkerPredsCheck.java @@ -20,7 +20,7 @@ import java.util.Map; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; import org.eclipse.escet.cif.metamodel.cif.declarations.DiscVariable; import org.eclipse.escet.cif.metamodel.cif.expressions.BinaryExpression; @@ -41,13 +41,13 @@ public class CompOnlyVarValueMarkerPredsCheck extends CifCheck { for (Expression marked: comp.getMarkeds()) { // The only supported form is 'discrete_variable = marked_value'. if (!(marked instanceof BinaryExpression)) { - violations.add(comp, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( + violations.add(comp, new ReportObjectTypeDescrMessage(), new LiteralMessage( "has a marker predicate that is not of the form \"discrete_variable = marked_value\"")); continue; } BinaryExpression bexpr = (BinaryExpression)marked; if (bexpr.getOperator() != BinaryOperator.EQUAL || !(bexpr.getLeft() instanceof DiscVariableExpression)) { - violations.add(comp, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( + violations.add(comp, new ReportObjectTypeDescrMessage(), new LiteralMessage( "has a marker predicate that is not of the form \"discrete_variable = marked_value\"")); continue; } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java index 58bc65268..cf9547f21 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/CompStateInvsOnlyReqsCheck.java @@ -17,7 +17,7 @@ import org.eclipse.escet.cif.common.CifTextUtils; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.ComplexComponent; import org.eclipse.escet.cif.metamodel.cif.InvKind; import org.eclipse.escet.cif.metamodel.cif.Invariant; @@ -32,7 +32,7 @@ public class CompStateInvsOnlyReqsCheck extends CifCheck { SupKind supKind = inv.getSupKind(); if (supKind != SupKind.REQUIREMENT) { String kindTxt = (supKind == SupKind.NONE) ? "kindless" : CifTextUtils.kindToStr(supKind); - violations.add(comp, new ReportObjectTypeDescriptionMessage(), + violations.add(comp, new ReportObjectTypeDescrMessage(), new LiteralMessage("has a %s state invariant", kindTxt)); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java index 8ff3f9129..1d52ef159 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoIfUpdatesCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.automata.IfUpdate; /** @@ -28,7 +28,7 @@ public class EdgeNoIfUpdatesCheck extends CifCheck { @Override protected void preprocessIfUpdate(IfUpdate update, CifCheckViolations violations) { // Report violation on the closest named ancestor of the 'if' update: a location or an automaton. - violations.add(update, new ReportObjectTypeDescriptionMessage(), + violations.add(update, new ReportObjectTypeDescrMessage(), new LiteralMessage("has an edge with an 'if' update")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java index 3b68a665a..620eabb40 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoMultiAssignCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; import org.eclipse.escet.cif.metamodel.cif.expressions.TupleExpression; @@ -31,7 +31,7 @@ public class EdgeNoMultiAssignCheck extends CifCheck { protected void preprocessAssignment(Assignment asgn, CifCheckViolations violations) { if (asgn.getAddressable() instanceof TupleExpression) { // Report violation on the closest named ancestor of the assignment: a location or an automaton. - violations.add(asgn, new ReportObjectTypeDescriptionMessage(), + violations.add(asgn, new ReportObjectTypeDescrMessage(), new LiteralMessage("has an edge with a multi-assignment")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java index 963a044cc..5feea06ab 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoPartialVarAssignCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Assignment; import org.eclipse.escet.cif.metamodel.cif.expressions.ProjectionExpression; @@ -30,7 +30,7 @@ public class EdgeNoPartialVarAssignCheck extends CifCheck { protected void preprocessAssignment(Assignment asgn, CifCheckViolations violations) { if (asgn.getAddressable() instanceof ProjectionExpression) { // Report violation on the closest named ancestor of the assignment: a location or an automaton. - violations.add(asgn, new ReportObjectTypeDescriptionMessage(), + violations.add(asgn, new ReportObjectTypeDescrMessage(), new LiteralMessage("has an edge with a partial variable assignment")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java index 6824a7bfe..28c8a37da 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EdgeNoUrgentCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Edge; /** CIF check that does not allow urgent edges. */ @@ -25,7 +25,7 @@ public class EdgeNoUrgentCheck extends CifCheck { protected void preprocessEdge(Edge edge, CifCheckViolations violations) { if (edge.isUrgent()) { // Report violation on the closest named ancestor of the edge: a location or an automaton. - violations.add(edge, new ReportObjectTypeDescriptionMessage(), new LiteralMessage("has an urgent edge")); + violations.add(edge, new ReportObjectTypeDescrMessage(), new LiteralMessage("has an urgent edge")); } } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java index 272336651..e578ce7a2 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.declarations.Event; /** CIF check that does not allow channels. */ @@ -24,7 +24,7 @@ public class EventNoChannelsCheck extends CifCheck { @Override protected void preprocessEvent(Event event, CifCheckViolations violations) { if (event.getType() != null) { - violations.add(event, new ReportObjectTypeDescriptionMessage(), + violations.add(event, new ReportObjectTypeDescrMessage(), new LiteralMessage("is a channel (has a data type)")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java index 539bda87e..fd0816065 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoTauCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Edge; import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; @@ -30,7 +30,7 @@ public class EventNoTauCheck extends CifCheck { protected void preprocessTauExpression(TauExpression tauExpr, CifCheckViolations violations) { // Explicit tau. // Report violation on the closest named ancestor of the tau expression: a location or an automaton. - violations.add(tauExpr, new ReportObjectTypeDescriptionMessage(), + violations.add(tauExpr, new ReportObjectTypeDescrMessage(), new LiteralMessage("has an edge with explicitly event \"tau\" on it")); } @@ -39,7 +39,7 @@ public class EventNoTauCheck extends CifCheck { // Implicit tau. if (edge.getEvents().isEmpty()) { // Report violation on the closest named ancestor of the edge: a location or an automaton. - violations.add(edge, new ReportObjectTypeDescriptionMessage(), + violations.add(edge, new ReportObjectTypeDescrMessage(), new LiteralMessage("has an edge with implicitly event \"tau\" on it")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java index 0b82524c9..f64d4a735 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventOnlyWithControllabilityCheck.java @@ -16,7 +16,7 @@ package org.eclipse.escet.cif.common.checkers.checks; import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Edge; import org.eclipse.escet.cif.metamodel.cif.declarations.Event; import org.eclipse.escet.cif.metamodel.cif.expressions.TauExpression; @@ -30,7 +30,7 @@ public class EventOnlyWithControllabilityCheck extends CifCheck { @Override protected void preprocessEvent(Event event, CifCheckViolations violations) { if (event.getControllable() == null) { - violations.add(event, new ReportObjectTypeDescriptionMessage(), + violations.add(event, new ReportObjectTypeDescrMessage(), new LiteralMessage("is not declared as controllable or uncontrollable")); } } @@ -39,7 +39,7 @@ public class EventOnlyWithControllabilityCheck extends CifCheck { protected void preprocessTauExpression(TauExpression tauExpr, CifCheckViolations violations) { // Explicit tau. // Report violation on the closest named ancestor of the tau expression: a location or an automaton. - violations.add(tauExpr, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( + violations.add(tauExpr, new ReportObjectTypeDescrMessage(), new LiteralMessage( "has an edge with explicitly event \"tau\" on it, which is not controllable or uncontrollable")); } @@ -48,7 +48,7 @@ public class EventOnlyWithControllabilityCheck extends CifCheck { // Implicit tau. if (edge.getEvents().isEmpty()) { // Report violation on the closest named ancestor of the edge: a location or an automaton. - violations.add(edge, new ReportObjectTypeDescriptionMessage(), new LiteralMessage( + violations.add(edge, new ReportObjectTypeDescrMessage(), new LiteralMessage( "has an edge with implicitly event \"tau\" on it, which is not controllable or uncontrollable")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java index b755e0c5c..9ac34d46b 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/InvNoKindlessStateEvtExclCheck.java @@ -18,7 +18,7 @@ import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnSelfMessage; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.InvKind; import org.eclipse.escet.cif.metamodel.cif.Invariant; import org.eclipse.escet.cif.metamodel.cif.SupKind; @@ -31,7 +31,7 @@ public class InvNoKindlessStateEvtExclCheck extends CifCheck { SupKind supKind = inv.getSupKind(); if (supKind == SupKind.NONE) { // The closest named ancestor of the invariant is the invariant itself, or a location or a component. - violations.add(inv, new ReportObjectTypeDescriptionMessage(), new IfReportOnAncestorMessage("has"), + violations.add(inv, new ReportObjectTypeDescrMessage(), new IfReportOnAncestorMessage("has"), new IfReportOnSelfMessage("is"), new LiteralMessage("a kindless state/event exclusion invariant, lacking a supervisory kind")); } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java index 25e7c3382..1140db93c 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoStateInvsCheck.java @@ -17,7 +17,7 @@ import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.InvKind; import org.eclipse.escet.cif.metamodel.cif.Invariant; import org.eclipse.escet.cif.metamodel.cif.automata.Location; @@ -30,7 +30,7 @@ public class LocNoStateInvsCheck extends CifCheck { for (Invariant inv: loc.getInvariants()) { if (inv.getInvKind() == InvKind.STATE) { // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage("has"), + violations.add(loc, new ReportObjectTypeDescrMessage(), new LiteralMessage("has"), new IfReportOnAncestorMessage("a location with"), new LiteralMessage("a state invariant")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java index 23b684a8a..8de7572e2 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocNoUrgentCheck.java @@ -17,7 +17,7 @@ import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnSelfMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Location; /** CIF check that does not allow urgent locations. */ @@ -27,7 +27,7 @@ public class LocNoUrgentCheck extends CifCheck { // Note that location parameters are never urgent. if (loc.isUrgent()) { // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new ReportObjectTypeDescriptionMessage(), + violations.add(loc, new ReportObjectTypeDescrMessage(), new IfReportOnAncestorMessage("has an urgent location"), new IfReportOnSelfMessage("is urgent")); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java index 5c70216a1..a881083f2 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java @@ -20,7 +20,7 @@ import org.eclipse.escet.cif.common.checkers.CifCheck; import org.eclipse.escet.cif.common.checkers.CifCheckViolations; import org.eclipse.escet.cif.common.checkers.messages.IfReportOnAncestorMessage; import org.eclipse.escet.cif.common.checkers.messages.LiteralMessage; -import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescriptionMessage; +import org.eclipse.escet.cif.common.checkers.messages.ReportObjectTypeDescrMessage; import org.eclipse.escet.cif.metamodel.cif.automata.Location; import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; @@ -34,12 +34,12 @@ public class LocOnlyStaticEvalMarkerPredsCheck extends CifCheck { evalPreds(loc.getMarkeds(), false, true); } catch (UnsupportedException e) { // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage("has"), + violations.add(loc, new ReportObjectTypeDescrMessage(), new LiteralMessage("has"), new IfReportOnAncestorMessage("a location with"), new LiteralMessage("a marker predicate that can not be evaluated statically")); } catch (CifEvalException e) { // Report violation on the location, or on its automaton in case the location has no name. - violations.add(loc, new ReportObjectTypeDescriptionMessage(), new LiteralMessage("has"), + violations.add(loc, new ReportObjectTypeDescrMessage(), new LiteralMessage("has"), new IfReportOnAncestorMessage("a location with"), new LiteralMessage("a marker predicate that can not be evaluated statically, " + "as the evaluation resulted in an evaluation error")); diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescriptionMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescrMessage.java similarity index 71% rename from cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescriptionMessage.java rename to cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescrMessage.java index 8c2470faa..6be59a16e 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescriptionMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescrMessage.java @@ -16,8 +16,17 @@ package org.eclipse.escet.cif.common.checkers.messages; import org.eclipse.escet.cif.common.CifTextUtils; import org.eclipse.escet.cif.common.checkers.CifCheckViolation; -/** Message describing the CIF object on which the violation is reported. */ -public class ReportObjectTypeDescriptionMessage extends CifCheckViolationMessage { +/** + * Message describing the {@link CifCheckViolation#getReportObject report object}, the CIF object on which the violation + * is reported. + * + *

    + * If the message is reported on the specification, {@code "the top level scope of the specification"} is used as + * message. Otherwise, {@link CifTextUtils#getTypeDescriptionForNamedObject} is called on the report object to obtain + * the description. + *

    + */ +public class ReportObjectTypeDescrMessage extends CifCheckViolationMessage { @Override public String getMessage(CifCheckViolation violation) { return violation.isReportOnSpecification() ? "the top level scope of the specification" -- GitLab From 18786108d10018d0ce31fcd844ac7994ccc60e60 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Thu, 22 Sep 2022 21:11:34 +0200 Subject: [PATCH 24/51] #398 Nicer formatting of larger numbers for some messages. --- .../cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java | 2 +- .../checkers/checks/VarNoDiscWithMultiInitValuesCheck.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java index 1b9beab7b..156fc5960 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java @@ -52,7 +52,7 @@ public class AutOnlyWithOneInitLocCheck extends CifCheck { new LiteralMessage("has no initial location")); } else if (initLocCount > 1) { violations.add(aut, new ReportObjectTypeDescrMessage(), - new LiteralMessage("has multiple (%d) initial locations", initLocCount)); + new LiteralMessage("has multiple (%,d) initial locations", initLocCount)); } // Skip if check is disabled (negative value). } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java index 881eb3ea5..07c3ab963 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/VarNoDiscWithMultiInitValuesCheck.java @@ -42,7 +42,7 @@ public class VarNoDiscWithMultiInitValuesCheck extends CifCheck { "discrete variable has multiple potential initial values (any value in its domain)")); } else if (count > 1) { violations.add(var, - new LiteralMessage("discrete variable has multiple (%d) potential initial values", count)); + new LiteralMessage("discrete variable has multiple (%,d) potential initial values", count)); } } } -- GitLab From 02f57ce8fb09b935e5ebb2e9ca63bb62fcaa4718 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Thu, 22 Sep 2022 21:16:06 +0200 Subject: [PATCH 25/51] #398 'Can not' to 'cannot' in checkers/messages. --- .../common/checkers/checks/AutOnlyWithOneInitLocCheck.java | 4 ++-- .../checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java | 4 ++-- .../tests/cif2supremica/invalid1.cif.cif2supremica.err | 2 +- .../tests/cif2supremica/invalid3.cif.cif2supremica.err | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java index 156fc5960..bffa61b0b 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/AutOnlyWithOneInitLocCheck.java @@ -28,7 +28,7 @@ import org.eclipse.escet.cif.metamodel.cif.automata.Location; import org.eclipse.escet.common.app.framework.exceptions.UnsupportedException; /** - * CIF check that allows automata only if they have exactly one initial location. Automata for which this can not be + * CIF check that allows automata only if they have exactly one initial location. Automata for which this cannot be * determined statically, are also not allowed. */ public class AutOnlyWithOneInitLocCheck extends CifCheck { @@ -72,7 +72,7 @@ public class AutOnlyWithOneInitLocCheck extends CifCheck { initial = loc.getInitials().isEmpty() ? false : evalPreds(loc.getInitials(), true, true); } catch (UnsupportedException e) { // Can only fail if there is at least one predicate. - errMsg = "as one of its initialization predicates can not be statically evaluated"; + errMsg = "as one of its initialization predicates cannot be statically evaluated"; } catch (CifEvalException e) { // Can only fail if there is at least one predicate. errMsg = "as evaluating one of its initialization predicates resulted in an evaluation error"; diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java index a881083f2..c90b6105a 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/LocOnlyStaticEvalMarkerPredsCheck.java @@ -36,12 +36,12 @@ public class LocOnlyStaticEvalMarkerPredsCheck extends CifCheck { // Report violation on the location, or on its automaton in case the location has no name. violations.add(loc, new ReportObjectTypeDescrMessage(), new LiteralMessage("has"), new IfReportOnAncestorMessage("a location with"), - new LiteralMessage("a marker predicate that can not be evaluated statically")); + new LiteralMessage("a marker predicate that cannot be evaluated statically")); } catch (CifEvalException e) { // Report violation on the location, or on its automaton in case the location has no name. violations.add(loc, new ReportObjectTypeDescrMessage(), new LiteralMessage("has"), new IfReportOnAncestorMessage("a location with"), - new LiteralMessage("a marker predicate that can not be evaluated statically, " + new LiteralMessage("a marker predicate that cannot be evaluated statically, " + "as the evaluation resulted in an evaluation error")); } } diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err index e74b249b3..430ffc9fd 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid1.cif.cif2supremica.err @@ -42,7 +42,7 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - Unsupported "g.p0.x1": discrete variable has multiple (2) potential initial values. - Unsupported "g.p0.x1": discrete variable has multiple predicates that specify its marked values. - Unsupported "g.p0.x2": discrete variable has multiple potential initial values (any value in its domain). - - Unsupported "g.p1": automaton has a location with a marker predicate that can not be evaluated statically, as the evaluation resulted in an evaluation error. + - Unsupported "g.p1": automaton has a location with a marker predicate that cannot be evaluated statically, as the evaluation resulted in an evaluation error. - Unsupported "g.p1": automaton has a location with a state invariant. - Unsupported "g.p1": failed to determine whether the automaton's location is an initial location, as evaluating one of its initialization predicates resulted in an evaluation error. - Unsupported "g.p1": uses binary operator ">" on operands of types "real" and "int[0..0]" in binary expression "sqrt(-1.0) > 0". diff --git a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif.cif2supremica.err b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif.cif2supremica.err index 861b059d3..1a5a567c1 100644 --- a/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif.cif2supremica.err +++ b/cif/org.eclipse.escet.cif.tests/tests/cif2supremica/invalid3.cif.cif2supremica.err @@ -1,3 +1,3 @@ ERROR: CIF to Supremica transformation failed due to unsatisfied preconditions: - - Unsupported "p": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates can not be statically evaluated. + - Unsupported "p": failed to determine whether the automaton's location is an initial location, as one of its initialization predicates cannot be statically evaluated. - Unsupported "p.b": discrete variable has multiple potential initial values (any value in its domain). -- GitLab From 28815a33dfc748e301046311e0cf38edecc482cc Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Thu, 22 Sep 2022 21:26:55 +0200 Subject: [PATCH 26/51] #398 Added missing violation reporting comment. --- .../escet/cif/common/checkers/checks/EventNoChannelsCheck.java | 1 + 1 file changed, 1 insertion(+) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java index e578ce7a2..9a83a5ece 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/checks/EventNoChannelsCheck.java @@ -24,6 +24,7 @@ public class EventNoChannelsCheck extends CifCheck { @Override protected void preprocessEvent(Event event, CifCheckViolations violations) { if (event.getType() != null) { + // Report violation on the event or event parameter. violations.add(event, new ReportObjectTypeDescrMessage(), new LiteralMessage("is a channel (has a data type)")); } -- GitLab From 59a10a9e42d8d539d9340d7a40a16da3a37fe364 Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Thu, 22 Sep 2022 21:27:37 +0200 Subject: [PATCH 27/51] #398 Small comment/naming improvements. --- .../cif/common/checkers/CifCheckViolation.java | 5 +++-- .../common/checkers/CifCheckViolations.java | 6 ++++-- .../messages/CifCheckViolationMessage.java | 2 +- .../messages/IfReportOnAncestorMessage.java | 8 ++++---- .../messages/IfReportOnSelfMessage.java | 8 ++++---- .../checkers/messages/LiteralMessage.java | 8 ++++---- .../messages/ReportObjectTypeDescrMessage.java | 6 +++--- .../checkers/messages/SequenceMessage.java | 18 +++++++++--------- 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java index a4c47e919..132f783f1 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolation.java @@ -52,7 +52,8 @@ public class CifCheckViolation { *
  • To report a violation on an entire specification, either a {@link Specification} or {@code null} may be * provided.
  • * - * @param message The message describing the violation. + * @param message The message describing the violation. The concatenated message should in principle not start with + * a capital letter, nor end with a period to end the sentence. * @see CifCheckViolations#add */ public CifCheckViolation(PositionObject cifObject, CifCheckViolationMessage message) { @@ -125,7 +126,7 @@ public class CifCheckViolation { public String toString() { String name = (actualReportObject == null) ? "specification" : "\"" + CifTextUtils.getAbsName(actualReportObject) + "\""; - String messageText = message.getMessage(this); + String messageText = message.getMessageText(this); return fmt("%s: %s.", name, messageText); } } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java index 236b7c48f..718c8a4b2 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/CifCheckViolations.java @@ -60,8 +60,10 @@ public class CifCheckViolations { *
  • To report a violation on an entire specification, either a {@link Specification} or {@code null} may be * provided.
  • * - * @param messages The non-empty sequence of concatenated messages describing the violation. The messages are - * trimmed and concatenated, with a space being added in between each two messages if needed. + * @param messages The non-empty sequence of concatenated messages describing the violation.The message texts of the + * messages are trimmed and concatenated, with a space being added in between each two message texts if needed. + * The concatenated message text should in principle not start with a capital letter, nor end with a period to + * end the sentence. * @see CifCheckViolation#CifCheckViolation */ public void add(PositionObject cifObject, CifCheckViolationMessage... messages) { diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/CifCheckViolationMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/CifCheckViolationMessage.java index 5705235d0..1ea3c6df0 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/CifCheckViolationMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/CifCheckViolationMessage.java @@ -23,7 +23,7 @@ public abstract class CifCheckViolationMessage { * @param violation The CIF check violation. * @return The violation message text. */ - public abstract String getMessage(CifCheckViolation violation); + public abstract String getMessageText(CifCheckViolation violation); @Override public abstract boolean equals(Object obj); diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java index 0860f4772..388c3697e 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnAncestorMessage.java @@ -27,9 +27,9 @@ public class IfReportOnAncestorMessage extends CifCheckViolationMessage { /** * Constructor for the {@link IfReportOnAncestorMessage} class. * - * @param messagePattern The message format pattern, to use if the violation is reported on an ancestor of the + * @param messagePattern The message text format pattern, to use if the violation is reported on an ancestor of the * object. - * @param args The message format arguments. + * @param args The message text format arguments. * @see Strings#fmt */ public IfReportOnAncestorMessage(String messagePattern, Object... args) { @@ -46,8 +46,8 @@ public class IfReportOnAncestorMessage extends CifCheckViolationMessage { } @Override - public String getMessage(CifCheckViolation violation) { - return violation.isReportOnSelf() ? "" : message.getMessage(violation); + public String getMessageText(CifCheckViolation violation) { + return violation.isReportOnSelf() ? "" : message.getMessageText(violation); } @Override diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java index 93cff2447..21d77f5a6 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/IfReportOnSelfMessage.java @@ -27,8 +27,8 @@ public class IfReportOnSelfMessage extends CifCheckViolationMessage { /** * Constructor for the {@link IfReportOnSelfMessage} class. * - * @param messagePattern The message format pattern, to use if the violation is reported on the object itself. - * @param args The message format arguments. + * @param messagePattern The message text format pattern, to use if the violation is reported on the object itself. + * @param args The message text format arguments. * @see Strings#fmt */ public IfReportOnSelfMessage(String messagePattern, Object... args) { @@ -45,8 +45,8 @@ public class IfReportOnSelfMessage extends CifCheckViolationMessage { } @Override - public String getMessage(CifCheckViolation violation) { - return violation.isReportOnSelf() ? message.getMessage(violation) : ""; + public String getMessageText(CifCheckViolation violation) { + return violation.isReportOnSelf() ? message.getMessageText(violation) : ""; } @Override diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java index e34f89e98..c4366167b 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/LiteralMessage.java @@ -20,14 +20,14 @@ import org.eclipse.escet.common.java.Strings; /** A literal message. */ public class LiteralMessage extends CifCheckViolationMessage { - /** The message. */ + /** The message text. */ private final String message; /** * Constructor for the {@link LiteralMessage} class. * - * @param messagePattern The message format pattern. - * @param args The message format arguments. + * @param messagePattern The message text format pattern. + * @param args The message text format arguments. * @see Strings#fmt */ public LiteralMessage(String messagePattern, Object... args) { @@ -35,7 +35,7 @@ public class LiteralMessage extends CifCheckViolationMessage { } @Override - public String getMessage(CifCheckViolation violation) { + public String getMessageText(CifCheckViolation violation) { return message; } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescrMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescrMessage.java index 6be59a16e..8f66b6c6d 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescrMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/ReportObjectTypeDescrMessage.java @@ -22,13 +22,13 @@ import org.eclipse.escet.cif.common.checkers.CifCheckViolation; * *

    * If the message is reported on the specification, {@code "the top level scope of the specification"} is used as - * message. Otherwise, {@link CifTextUtils#getTypeDescriptionForNamedObject} is called on the report object to obtain - * the description. + * description. Otherwise, {@link CifTextUtils#getTypeDescriptionForNamedObject} is called on the report object to + * obtain the description. *

    */ public class ReportObjectTypeDescrMessage extends CifCheckViolationMessage { @Override - public String getMessage(CifCheckViolation violation) { + public String getMessageText(CifCheckViolation violation) { return violation.isReportOnSpecification() ? "the top level scope of the specification" : CifTextUtils.getTypeDescriptionForNamedObject(violation.getReportObject()); } diff --git a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java index 14465df78..ce6c6b1cb 100644 --- a/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java +++ b/cif/org.eclipse.escet.cif.common/src/org/eclipse/escet/cif/common/checkers/messages/SequenceMessage.java @@ -26,8 +26,8 @@ public class SequenceMessage extends CifCheckViolationMessage { /** * Constructor for the {@link SequenceMessage} class. * - * @param messages The non-empty sequence of messages. The messages are trimmed and concatenated, with a space being - * added in between each two messages if needed. + * @param messages The non-empty sequence of messages. The message texts of the messages are trimmed and + * concatenated, with a space being added in between each two message texts if needed. */ public SequenceMessage(List messages) { Assert.check(!messages.isEmpty()); @@ -35,19 +35,19 @@ public class SequenceMessage extends CifCheckViolationMessage { } @Override - public String getMessage(CifCheckViolation violation) { - StringBuilder text = new StringBuilder(); + public String getMessageText(CifCheckViolation violation) { + StringBuilder concatenatedText = new StringBuilder(); for (CifCheckViolationMessage message: messages) { - String messageText = message.getMessage(violation); + String messageText = message.getMessageText(violation); messageText = messageText.trim(); if (!messageText.isEmpty()) { // Only add if not empty. - if (text.length() > 0) { // Add separator if there is any text already present. - text.append(" "); + if (concatenatedText.length() > 0) { // Add separator if there is any text already present. + concatenatedText.append(" "); } - text.append(messageText); + concatenatedText.append(messageText); } } - return text.toString(); + return concatenatedText.toString(); } @Override -- GitLab From 9fefcdfce48b5b186e8daca5cfc11782eafe5eea Mon Sep 17 00:00:00 2001 From: Dennis Hendriks Date: Thu, 22 Sep 2022 22:03:10 +0200 Subject: [PATCH 28/51] #347 Style names / named styles -> stylables. - Related enum class names are now also singular. --- .../chi/texteditor/ChiSourceViewerConfig.java | 10 +++---- .../escet/chi/texteditor/ChiTextEditor.java | 2 +- .../texteditor/ChiTextEditorDarkTheme.java | 6 ++-- .../texteditor/ChiTextEditorLightTheme.java | 6 ++-- ...eNames.java => ChiTextEditorStylable.java} | 22 +++++++------- .../escet/chi/texteditor/ChiTextScanner.java | 14 ++++----- .../cif/texteditor/CifCodeHighlighter.java | 4 +-- .../cif/texteditor/CifSourceViewerConfig.java | 12 ++++---- .../escet/cif/texteditor/CifTextEditor.java | 2 +- .../texteditor/CifTextEditorDarkTheme.java | 6 ++-- .../texteditor/CifTextEditorLightTheme.java | 6 ++-- .../cif/texteditor/CifTextEditorScanner.java | 20 ++++++------- ...eNames.java => CifTextEditorStylable.java} | 30 +++++++++---------- .../texteditor/SeTextCodeHighlighter.java | 4 +-- .../texteditor/SeTextSourceViewerConfig.java | 10 +++---- .../setext/texteditor/SeTextTextEditor.java | 2 +- .../texteditor/SeTextTextEditorDarkTheme.java | 6 ++-- .../SeTextTextEditorLightTheme.java | 6 ++-- .../texteditor/SeTextTextEditorScanner.java | 10 +++---- ...mes.java => SeTextTextEditorStylable.java} | 18 +++++------ .../texteditorbase/GenericTextEditor.java | 2 +- .../themes/AutoDarkLightTheme.java | 6 ++-- .../themes/TextEditorTheme.java | 10 +++---- .../texteditor/ToolDefSourceViewerConfig.java | 12 ++++---- .../tooldef/texteditor/ToolDefTextEditor.java | 2 +- .../ToolDefTextEditorDarkTheme.java | 6 ++-- .../ToolDefTextEditorLightTheme.java | 6 ++-- .../texteditor/ToolDefTextEditorScanner.java | 14 ++++----- ...es.java => ToolDefTextEditorStylable.java} | 24 +++++++-------- 29 files changed, 139 insertions(+), 139 deletions(-) rename chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/{ChiTextEditorStyleNames.java => ChiTextEditorStylable.java} (65%) rename cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/{CifTextEditorStyleNames.java => CifTextEditorStylable.java} (59%) rename setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/{SeTextTextEditorStyleNames.java => SeTextTextEditorStylable.java} (70%) rename tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/{ToolDefTextEditorStyleNames.java => ToolDefTextEditorStylable.java} (64%) diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiSourceViewerConfig.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiSourceViewerConfig.java index e4b9e5641..b0266d3c4 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiSourceViewerConfig.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiSourceViewerConfig.java @@ -13,9 +13,9 @@ package org.eclipse.escet.chi.texteditor; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.COMMENT_SL; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.STRING; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.STRING_ESCAPE; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.COMMENT_SL; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.STRING; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.STRING_ESCAPE; import org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration; import org.eclipse.escet.setext.texteditorbase.scanners.FormatStringScanner; @@ -27,14 +27,14 @@ import org.eclipse.jface.text.rules.ITokenScanner; /** Chi text editor source viewer configuration. */ public class ChiSourceViewerConfig extends GenericSourceViewerConfiguration { /** The theme to use. */ - private final TextEditorTheme theme; + private final TextEditorTheme theme; /** * Constructor for the {@link ChiSourceViewerConfig} class. * * @param theme The theme to use. */ - public ChiSourceViewerConfig(TextEditorTheme theme) { + public ChiSourceViewerConfig(TextEditorTheme theme) { this.theme = theme; } diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditor.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditor.java index d58344c45..257d7fc71 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditor.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditor.java @@ -22,7 +22,7 @@ import org.eclipse.escet.chi.typecheck.ChiTypeChecker; import org.eclipse.escet.setext.texteditorbase.GenericTextEditor; /** Chi text editor for Eclipse. */ -public class ChiTextEditor extends GenericTextEditor, Specification, ChiTextEditorStyleNames> { +public class ChiTextEditor extends GenericTextEditor, Specification, ChiTextEditorStylable> { /** Constructor for the {@link ChiTextEditor} class. */ public ChiTextEditor() { super(new ChiPartitionScanner(), theme -> new ChiSourceViewerConfig(theme), new ChiTextEditorDarkTheme(), diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java index ceec977c3..ce40607b2 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorDarkTheme.java @@ -18,10 +18,10 @@ import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.swt.SWT; /** Chi text editor dark theme. */ -public class ChiTextEditorDarkTheme implements TextEditorTheme { +public class ChiTextEditorDarkTheme implements TextEditorTheme { @Override - public Style getStyle(ChiTextEditorStyleNames namedStyle) { - switch (namedStyle) { + public Style getStyle(ChiTextEditorStylable stylable) { + switch (stylable) { case DEFAULT: return new Style(240, 240, 240); case IDENTIFIER: diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorLightTheme.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorLightTheme.java index bbc520fd4..0cbfd3932 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorLightTheme.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorLightTheme.java @@ -18,10 +18,10 @@ import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.swt.SWT; /** Chi text editor light theme. */ -public class ChiTextEditorLightTheme implements TextEditorTheme { +public class ChiTextEditorLightTheme implements TextEditorTheme { @Override - public Style getStyle(ChiTextEditorStyleNames namedStyle) { - switch (namedStyle) { + public Style getStyle(ChiTextEditorStylable stylable) { + switch (stylable) { case DEFAULT: return new Style(0, 0, 0); case IDENTIFIER: diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStyleNames.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStylable.java similarity index 65% rename from chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStyleNames.java rename to chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStylable.java index fb36a0b5d..e062be7f2 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStyleNames.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextEditorStylable.java @@ -13,32 +13,32 @@ package org.eclipse.escet.chi.texteditor; -/** Chi text editor style names. */ -public enum ChiTextEditorStyleNames { - /** Default style. */ +/** Chi text editor stylable. */ +public enum ChiTextEditorStylable { + /** Default. */ DEFAULT, - /** Identifier style. */ + /** Identifier. */ IDENTIFIER, - /** Single-line comment style. */ + /** Single-line comment. */ COMMENT_SL, - /** String literal style. */ + /** String literal. */ STRING, - /** String literal escape sequence style. */ + /** String literal escape sequence. */ STRING_ESCAPE, - /** Keyword style. */ + /** Keyword. */ KEYWORD, - /** Standard library function style. */ + /** Standard library function. */ STDLIBFUNC, - /** Operator style. */ + /** Operator. */ OPERATOR, - /** Number literal style. */ + /** Number literal. */ NUMBER, } diff --git a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextScanner.java b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextScanner.java index ac57edbf9..51271e16f 100644 --- a/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextScanner.java +++ b/chi/org.eclipse.escet.chi.texteditor/src/org/eclipse/escet/chi/texteditor/ChiTextScanner.java @@ -13,12 +13,12 @@ package org.eclipse.escet.chi.texteditor; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.DEFAULT; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.IDENTIFIER; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.KEYWORD; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.NUMBER; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.OPERATOR; -import static org.eclipse.escet.chi.texteditor.ChiTextEditorStyleNames.STDLIBFUNC; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.DEFAULT; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.IDENTIFIER; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.KEYWORD; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.NUMBER; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.OPERATOR; +import static org.eclipse.escet.chi.texteditor.ChiTextEditorStylable.STDLIBFUNC; import org.eclipse.escet.chi.parser.ChiScanner; import org.eclipse.escet.setext.texteditorbase.ColorManager; @@ -40,7 +40,7 @@ public class ChiTextScanner extends RuleBasedScanner { * @param theme The theme to use. * @param manager The color manager to use to create the color tokens. */ - public ChiTextScanner(TextEditorTheme theme, ColorManager manager) { + public ChiTextScanner(TextEditorTheme theme, ColorManager manager) { String[] keywords = ChiScanner.getKeywords("Keywords"); String[] types = ChiScanner.getKeywords("Types"); String[] constants = ChiScanner.getKeywords("Constants"); diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifCodeHighlighter.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifCodeHighlighter.java index c875ed90f..29e3f6fdf 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifCodeHighlighter.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifCodeHighlighter.java @@ -21,14 +21,14 @@ import org.eclipse.jface.text.presentation.IPresentationReconciler; /** CIF code highlighter. */ public class CifCodeHighlighter extends CodeHighlighter { /** The theme to use. */ - private final TextEditorTheme theme; + private final TextEditorTheme theme; /** * Constructor for the {@link CifCodeHighlighter} class. * * @param theme The theme to use. */ - public CifCodeHighlighter(TextEditorTheme theme) { + public CifCodeHighlighter(TextEditorTheme theme) { this.theme = theme; } diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifSourceViewerConfig.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifSourceViewerConfig.java index ab6a99845..d86995a39 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifSourceViewerConfig.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifSourceViewerConfig.java @@ -13,10 +13,10 @@ package org.eclipse.escet.cif.texteditor; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.COMMENT_ML; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.COMMENT_SL; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.STRING; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.STRING_ESCAPE; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.COMMENT_ML; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.COMMENT_SL; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.STRING; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.STRING_ESCAPE; import org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration; import org.eclipse.escet.setext.texteditorbase.scanners.FormatStringScanner; @@ -28,14 +28,14 @@ import org.eclipse.jface.text.rules.ITokenScanner; /** CIF text editor source viewer configuration. */ public class CifSourceViewerConfig extends GenericSourceViewerConfiguration { /** The theme to use. */ - private final TextEditorTheme theme; + private final TextEditorTheme theme; /** * Constructor for the {@link CifSourceViewerConfig} class. * * @param theme The theme to use. */ - public CifSourceViewerConfig(TextEditorTheme theme) { + public CifSourceViewerConfig(TextEditorTheme theme) { this.theme = theme; } diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditor.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditor.java index d84fac609..953ce555d 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditor.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditor.java @@ -20,7 +20,7 @@ import org.eclipse.escet.cif.typechecker.CifTypeChecker; import org.eclipse.escet.setext.texteditorbase.GenericTextEditor; /** CIF text editor for Eclipse. */ -public class CifTextEditor extends GenericTextEditor { +public class CifTextEditor extends GenericTextEditor { /** Constructor for the {@link CifTextEditor} class. */ public CifTextEditor() { super(new CifPartitionScanner(), theme -> new CifSourceViewerConfig(theme), new CifTextEditorDarkTheme(), diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java index 5e92384b4..7e6c8844e 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorDarkTheme.java @@ -18,10 +18,10 @@ import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.swt.SWT; /** CIF text editor dark theme. */ -public class CifTextEditorDarkTheme implements TextEditorTheme { +public class CifTextEditorDarkTheme implements TextEditorTheme { @Override - public Style getStyle(CifTextEditorStyleNames namedStyle) { - switch (namedStyle) { + public Style getStyle(CifTextEditorStylable stylable) { + switch (stylable) { case DEFAULT: return new Style(240, 240, 240); case IDENTIFIER: diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorLightTheme.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorLightTheme.java index e0ffe5482..ee407b711 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorLightTheme.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorLightTheme.java @@ -18,10 +18,10 @@ import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.swt.SWT; /** CIF text editor light theme. */ -public class CifTextEditorLightTheme implements TextEditorTheme { +public class CifTextEditorLightTheme implements TextEditorTheme { @Override - public Style getStyle(CifTextEditorStyleNames namedStyle) { - switch (namedStyle) { + public Style getStyle(CifTextEditorStylable stylable) { + switch (stylable) { case DEFAULT: return new Style(0, 0, 0); case IDENTIFIER: diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorScanner.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorScanner.java index 30f5b8c32..66199cd37 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorScanner.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorScanner.java @@ -13,15 +13,15 @@ package org.eclipse.escet.cif.texteditor; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.C_EVENT; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.DEFAULT; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.E_EVENT; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.IDENTIFIER; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.KEYWORD; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.NUMBER; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.OPERATOR; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.STDLIBFUNC; -import static org.eclipse.escet.cif.texteditor.CifTextEditorStyleNames.U_EVENT; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.C_EVENT; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.DEFAULT; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.E_EVENT; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.IDENTIFIER; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.KEYWORD; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.NUMBER; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.OPERATOR; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.STDLIBFUNC; +import static org.eclipse.escet.cif.texteditor.CifTextEditorStylable.U_EVENT; import static org.eclipse.escet.common.java.Strings.fmt; import org.apache.commons.lang3.ArrayUtils; @@ -45,7 +45,7 @@ public class CifTextEditorScanner extends RuleBasedScannerEx { * @param theme The theme to use. * @param manager The color manager to use to create the color tokens. */ - public CifTextEditorScanner(TextEditorTheme theme, ColorManager manager) { + public CifTextEditorScanner(TextEditorTheme theme, ColorManager manager) { // Keywords copied from CIF scanner. String[] keywords = CifScanner.getKeywords("Keywords"); String[] supKinds = CifScanner.getKeywords("SupKind"); diff --git a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStyleNames.java b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStylable.java similarity index 59% rename from cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStyleNames.java rename to cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStylable.java index 92df6ca8b..7aa8512ee 100644 --- a/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStyleNames.java +++ b/cif/org.eclipse.escet.cif.texteditor/src/org/eclipse/escet/cif/texteditor/CifTextEditorStylable.java @@ -13,44 +13,44 @@ package org.eclipse.escet.cif.texteditor; -/** CIF text editor style names. */ -public enum CifTextEditorStyleNames { - /** Default style. */ +/** CIF text editor stylable. */ +public enum CifTextEditorStylable { + /** Default. */ DEFAULT, - /** Identifier style. */ + /** Identifier. */ IDENTIFIER, - /** Single-line comment style. */ + /** Single-line comment. */ COMMENT_SL, - /** Multi-line comment style. */ + /** Multi-line comment. */ COMMENT_ML, - /** String literal style. */ + /** String literal. */ STRING, - /** String literal escape sequence style. */ + /** String literal escape sequence. */ STRING_ESCAPE, - /** Keyword style. */ + /** Keyword. */ KEYWORD, - /** Standard library function style. */ + /** Standard library function. */ STDLIBFUNC, - /** Operator style. */ + /** Operator. */ OPERATOR, - /** Number literal style. */ + /** Number literal. */ NUMBER, - /** Controllable event name style. */ + /** Controllable event name. */ C_EVENT, - /** Uncontrollable event name style. */ + /** Uncontrollable event name. */ U_EVENT, - /** Event name style. */ + /** Event name. */ E_EVENT, } diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighter.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighter.java index 68be5ec54..e91693d97 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighter.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextCodeHighlighter.java @@ -21,14 +21,14 @@ import org.eclipse.jface.text.presentation.IPresentationReconciler; /** SeText code highlighter. */ public class SeTextCodeHighlighter extends CodeHighlighter { /** The theme to use. */ - private final TextEditorTheme theme; + private final TextEditorTheme theme; /** * Constructor for the {@link SeTextCodeHighlighter} class. * * @param theme The theme to use. */ - public SeTextCodeHighlighter(TextEditorTheme theme) { + public SeTextCodeHighlighter(TextEditorTheme theme) { this.theme = theme; } diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextSourceViewerConfig.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextSourceViewerConfig.java index 90ff88fba..ae5db459d 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextSourceViewerConfig.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextSourceViewerConfig.java @@ -13,9 +13,9 @@ package org.eclipse.escet.setext.texteditor; -import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.COMMENT_ML; -import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.COMMENT_SL; -import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.STRING; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStylable.COMMENT_ML; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStylable.COMMENT_SL; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStylable.STRING; import org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration; import org.eclipse.escet.setext.texteditorbase.scanners.SingleStyleScanner; @@ -26,14 +26,14 @@ import org.eclipse.jface.text.rules.ITokenScanner; /** SeText text editor source viewer configuration. */ public class SeTextSourceViewerConfig extends GenericSourceViewerConfiguration { /** The theme to use. */ - private final TextEditorTheme theme; + private final TextEditorTheme theme; /** * Constructor for the {@link SeTextSourceViewerConfig} class. * * @param theme The theme to use. */ - public SeTextSourceViewerConfig(TextEditorTheme theme) { + public SeTextSourceViewerConfig(TextEditorTheme theme) { this.theme = theme; } diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditor.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditor.java index f6c285c66..b5c7cc51c 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditor.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditor.java @@ -19,7 +19,7 @@ import org.eclipse.escet.setext.texteditorbase.GenericTextEditor; import org.eclipse.escet.setext.typechecker.SeTextTypeChecker; /** SeText text editor for Eclipse. */ -public class SeTextTextEditor extends GenericTextEditor { +public class SeTextTextEditor extends GenericTextEditor { /** Constructor for the {@link SeTextTextEditor} class. */ public SeTextTextEditor() { super(new SeTextPartitionScanner(), theme -> new SeTextSourceViewerConfig(theme), diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorDarkTheme.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorDarkTheme.java index 946cfa1a0..69fa8264d 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorDarkTheme.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorDarkTheme.java @@ -18,10 +18,10 @@ import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.swt.SWT; /** SeText text editor dark theme. */ -public class SeTextTextEditorDarkTheme implements TextEditorTheme { +public class SeTextTextEditorDarkTheme implements TextEditorTheme { @Override - public Style getStyle(SeTextTextEditorStyleNames namedStyle) { - switch (namedStyle) { + public Style getStyle(SeTextTextEditorStylable stylable) { + switch (stylable) { case DEFAULT: return new Style(240, 240, 240); case IDENTIFIER: diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorLightTheme.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorLightTheme.java index 0c964baf3..67ad282f8 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorLightTheme.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorLightTheme.java @@ -18,10 +18,10 @@ import org.eclipse.escet.setext.texteditorbase.themes.TextEditorTheme; import org.eclipse.swt.SWT; /** SeText text editor light theme. */ -public class SeTextTextEditorLightTheme implements TextEditorTheme { +public class SeTextTextEditorLightTheme implements TextEditorTheme { @Override - public Style getStyle(SeTextTextEditorStyleNames namedStyle) { - switch (namedStyle) { + public Style getStyle(SeTextTextEditorStylable stylable) { + switch (stylable) { case DEFAULT: return new Style(0, 0, 0); case IDENTIFIER: diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorScanner.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorScanner.java index 8db7302ee..573fa32de 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorScanner.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorScanner.java @@ -14,10 +14,10 @@ package org.eclipse.escet.setext.texteditor; import static org.eclipse.escet.common.java.Strings.fmt; -import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.DEFAULT; -import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.DESCRIPTION; -import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.IDENTIFIER; -import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStyleNames.KEYWORD; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStylable.DEFAULT; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStylable.DESCRIPTION; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStylable.IDENTIFIER; +import static org.eclipse.escet.setext.texteditor.SeTextTextEditorStylable.KEYWORD; import org.eclipse.escet.setext.parser.SeTextScanner; import org.eclipse.escet.setext.texteditorbase.ColorManager; @@ -37,7 +37,7 @@ public class SeTextTextEditorScanner extends RuleBasedScannerEx { * @param theme The theme to use. * @param manager The color manager to use to create the color tokens. */ - public SeTextTextEditorScanner(TextEditorTheme theme, ColorManager manager) { + public SeTextTextEditorScanner(TextEditorTheme theme, ColorManager manager) { // Get keywords. String[] keywords = SeTextScanner.getKeywords("Keywords"); diff --git a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStyleNames.java b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStylable.java similarity index 70% rename from setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStyleNames.java rename to setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStylable.java index 2ac3c1563..e289756e4 100644 --- a/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStyleNames.java +++ b/setext/org.eclipse.escet.setext.texteditor/src/org/eclipse/escet/setext/texteditor/SeTextTextEditorStylable.java @@ -13,26 +13,26 @@ package org.eclipse.escet.setext.texteditor; -/** SeText text editor style names. */ -public enum SeTextTextEditorStyleNames { - /** Default style. */ +/** SeText text editor stylable. */ +public enum SeTextTextEditorStylable { + /** Default. */ DEFAULT, - /** Identifier style. */ + /** Identifier. */ IDENTIFIER, - /** Description style. */ + /** Description. */ DESCRIPTION, - /** Single-line comment style. */ + /** Single-line comment. */ COMMENT_SL, - /** Multi-line comment style. */ + /** Multi-line comment. */ COMMENT_ML, - /** String literal style. */ + /** String literal. */ STRING, - /** Keyword style. */ + /** Keyword. */ KEYWORD, } diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java index 0f870b11d..4cccf5ff3 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/GenericTextEditor.java @@ -91,7 +91,7 @@ import org.eclipse.ui.texteditor.MarkerUtilities; * type, such as {@link Object}. * @param The type of the decorated abstract syntax tree that results from type checking. If no type checker is * available, use a dummy type, such as {@link Object}. - * @param The enum with the named styles of the text editor. + * @param The enum with the stylables of the text editor. */ public class GenericTextEditor> extends TextEditor implements IDocumentListener, IPartListener diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java index 3819e3770..d41ba741d 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/AutoDarkLightTheme.java @@ -24,7 +24,7 @@ import org.eclipse.escet.setext.texteditorbase.Style; * dark theme, but as a light theme. *

    * - * @param The enum with the named styles of a text editor. + * @param The enum with the stylables of a text editor. */ public class AutoDarkLightTheme implements TextEditorTheme { /** The dark or light theme to use. */ @@ -41,7 +41,7 @@ public class AutoDarkLightTheme implements TextEditorTheme { } @Override - public Style getStyle(T namedStyle) { - return theme.getStyle(namedStyle); + public Style getStyle(T stylable) { + return theme.getStyle(stylable); } } diff --git a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/TextEditorTheme.java b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/TextEditorTheme.java index 238cbeb86..91dcf6c02 100644 --- a/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/TextEditorTheme.java +++ b/setext/org.eclipse.escet.setext.texteditorbase/src/org/eclipse/escet/setext/texteditorbase/themes/TextEditorTheme.java @@ -18,14 +18,14 @@ import org.eclipse.escet.setext.texteditorbase.Style; /** * A text editor theme. * - * @param The enum with the named styles of a text editor. + * @param The enum with the stylables of a text editor. */ public interface TextEditorTheme { /** - * Returns the themed style for a given named style. + * Returns the style for a given stylable. * - * @param namedStyle The named style. - * @return The themed style. + * @param stylable The stylable. + * @return The style. */ - public Style getStyle(T namedStyle); + public Style getStyle(T stylable); } diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefSourceViewerConfig.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefSourceViewerConfig.java index b20dfc28d..ff715622e 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefSourceViewerConfig.java +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefSourceViewerConfig.java @@ -13,10 +13,10 @@ package org.eclipse.escet.tooldef.texteditor; -import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.COMMENT_ML; -import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.COMMENT_SL; -import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.STRING; -import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStyleNames.STRING_ESCAPE; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStylable.COMMENT_ML; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStylable.COMMENT_SL; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStylable.STRING; +import static org.eclipse.escet.tooldef.texteditor.ToolDefTextEditorStylable.STRING_ESCAPE; import org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration; import org.eclipse.escet.setext.texteditorbase.scanners.FormatStringScanner; @@ -28,14 +28,14 @@ import org.eclipse.jface.text.rules.ITokenScanner; /** ToolDef text editor source viewer configuration. */ public class ToolDefSourceViewerConfig extends GenericSourceViewerConfiguration { /** The theme to use. */ - private final TextEditorTheme theme; + private final TextEditorTheme theme; /** * Constructor for the {@link ToolDefSourceViewerConfig} class. * * @param theme The theme to use. */ - public ToolDefSourceViewerConfig(TextEditorTheme theme) { + public ToolDefSourceViewerConfig(TextEditorTheme theme) { this.theme = theme; } diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditor.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditor.java index 18fa90d9d..8f24a2ded 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditor.java +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditor.java @@ -19,7 +19,7 @@ import org.eclipse.escet.tooldef.parser.ToolDefParser; import org.eclipse.escet.tooldef.typechecker.ToolDefTypeChecker; /** ToolDef text editor for Eclipse. */ -public class ToolDefTextEditor extends GenericTextEditor { +public class ToolDefTextEditor extends GenericTextEditor { /** Constructor for the {@link ToolDefTextEditor} class. */ public ToolDefTextEditor() { super(new ToolDefPartitionScanner(), theme -> new ToolDefSourceViewerConfig(theme), diff --git a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorDarkTheme.java b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorDarkTheme.java index 306e4e312..b51464317 100644 --- a/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/tooldef/texteditor/ToolDefTextEditorDarkTheme.java +++ b/tooldef/org.eclipse.escet.tooldef.texteditor/src/org/eclipse/escet/too