Skip to content
Snippets Groups Projects
Commit 06427258 authored by René Schöne's avatar René Schöne
Browse files

Move grammar2uml to separate repository

- also use mkdocs for pages, include ragdoc
parent b9eff203
No related branches found
No related tags found
1 merge request!60.3.6
Pipeline #12727 failed
Showing
with 13 additions and 236 deletions
package de.tudresden.inf.st.jastadd.grammar2uml.compiler;
import java.util.*;
import java.util.function.Predicate;
import static java.util.stream.Collectors.toList;
public class Utils {
public static <T> List<T> filterToList(Collection<T> collection, Predicate<T> predicate) {
return collection.stream().filter(predicate).collect(toList());
}
public static <T> Set<T> asSet(T... t) {
return new HashSet<T>(Arrays.asList(t));
}
}
{{typeName}} *-- {{{modifier}}} {{componentName}} {{#Label}}: {{Label}}{{/Label}}
package {{name}} <<Folder>> {
{{#InnerTypeDecls}} {{> TypeDecl}}{{/InnerTypeDecls}}
}
{{superClassName}} <|-- {{subClassName}}
{{leftName}} {{{leftModifier}}} {{#isBidirectional}}<{{/isBidirectional}}--> {{{rightModifier}}} {{rightName}} {{#Label}}: {{Label}}{{/Label}}
{{=<% %>=}}<%#isAbstract%>abstract <%/isAbstract%>class <%name%><%#InnerTokenComponents%><%#first%> {
<%/first%>
<%name%>
<%#last%>
}<%/last%><%/InnerTokenComponents%><%={{ }}=%>
```plantuml
@startuml
hide circle
hide methods
{{#Folders}}{{> Folder}}{{/Folders}}
{{#OtherTypes}}{{> TypeDecl}}{{/OtherTypes}}
{{#Containments}}{{> Containment}}{{/Containments}}
{{#Relations}}{{> Relation}}{{/Relations}}
{{#Inheritances}}{{> Inheritance}}{{/Inheritances}}
@enduml
```
#Fri Jan 15 20:11:10 CET 2021
version=0.1.1
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
\ No newline at end of file
package de.tudresden.inf.st.jastadd.grammar2uml.test;
import org.jastadd.relast.compiler.CompilerException;
import de.tudresden.inf.st.jastadd.grammar2uml.compiler.Compiler;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* TODO: Add description.
*
* @author rschoene - Initial contribution
*/
public class CompilerTest {
@SuppressWarnings("SameParameterValue")
void transform(String inputGrammar, String inputGrammar2Uml, String output) throws CompilerException {
System.out.println("Running test in directory '" + Paths.get(".").toAbsolutePath() + "'.");
assertTrue(Paths.get(inputGrammar).toFile().exists(), "input grammar does not exist");
assertTrue(Paths.get(inputGrammar2Uml).toFile().exists(), "input grammar2uml does not exist");
assertFalse(Paths.get(inputGrammar).toFile().isDirectory(), "input grammar is a directory");
assertFalse(Paths.get(inputGrammar2Uml).toFile().isDirectory(), "input grammar2uml is a directory");
File outputFile = Paths.get(output).toFile();
File outputDirFile = outputFile.getParentFile();
if (!outputDirFile.exists()) {
assertTrue(outputDirFile.mkdir());
}
String[] args = {
"--output=" + output,
"--inputGrammar2Uml=" + inputGrammar2Uml,
"--defaultFolders",
inputGrammar
};
new Compiler().run(args);
}
@Test
void transformMinimalExample() throws CompilerException {
transform("src/test/resources/Example.relast", "src/test/resources/Example.grammar2uml", "src/test/resources/uml.md");
}
}
uml.md
folder Datenfluss: Prüfmethode, Funktionsprinzip, Datenausgangswert, Verarbeitungsschritt, Dateneingangswert, Wert, Datenquelle, Quelle
folder Darstellung: DarstellungsElement, Dezimalwert, Auffälligkeitsmarkierung, Text
Root ::= Prüfmethode* Wert*;
// Beispiel für Prüfmethode: ReLiAbweichung
Prüfmethode ::= Funktionsprinzip Zielobjekt*;
Zielobjekt;
rel Prüfmethode.Funktionsprinzip* -> Funktionsprinzip;
// Beispiel Funktionsprinzip: Berechnungen innerhalb von ReLi-Abweichung für ist_diff und ist_diff < max_diff
Funktionsprinzip ::= Dateneingangswert* Verarbeitungsschritt* Datenausgangswert*;
abstract Datenquelle;
// Beispiel für Wert: FB_links, ist_diff, max_diff
Wert : Datenquelle ::= <Datentyp> <A> <B>;
// Ein Wert, der bei "Dateneingang" steht, z.B. für ReLi: max_Diff oder FB,links
// Beispiel für Dateneingangswert: Zuordnung, aus welcher Quelle der Wert ausgelesen werden soll
Dateneingangswert ::= [Quelle];
rel Dateneingangswert.Wert -> Wert;
// Beispiel für Verarbeitungsschritt: ist_Diff = ..., oder ist_diff < max_diff
Verarbeitungsschritt : Datenquelle ::= <Berechnungsvorschrift>;
rel Verarbeitungsschritt.EingabeWert* -> Wert;
// Ein Wert, der bei "Datenausgang" steht, z.B. für ReLi $ist_{Diff,Achse n}$
Datenausgangswert ::= DarstellungsElement;
rel Datenausgangswert.Wert -> Wert;
// Beispiel für Quelle: Rollenbremsprüfstand
Quelle;
abstract DarstellungsElement ;
Dezimalwert : DarstellungsElement;
Auffälligkeitsmarkierung : DarstellungsElement;
Text : DarstellungsElement;
rel Auffälligkeitsmarkierung.Element <-> DarstellungsElement.Auffälligkeitsmarkierung;
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
\ No newline at end of file
/public/
/docs/ragdoc/
__pycache__
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = public
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
pages/_static/grammar2uml.png

167 KiB

pages/_static/minimal-example.png

9.87 KiB

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import sphinx_rtd_theme
# -- Project information -----------------------------------------------------
project = 'Relast2Uml'
copyright = '2021, René Schöne'
author = 'René Schöne'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_rtd_theme',
'recommonmark',
'sphinxemoji.sphinxemoji',
'sphinx_markdown_tables'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['public', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
sphinxemoji_style = 'twemoji'
{% block footer %}
<p>{% if config.copyright %}
<small>{{ config.copyright }}<br></small>
{% endif %}
<hr>
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
{% if page and page.meta and page.meta.git_revision_date_localized %}
<small><br><i>Last updated {{ page.meta.git_revision_date_localized }}</i></small>
{% endif %}
</p>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment