net.sourceforge.plantuml.syntax.LanguageDescriptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
The newest version!
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
/* +=======================================================================
* |
* | PlantUML : a free UML diagram generator
* |
* +=======================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/liberapay (only 1€ per month!)
* https://plantuml.com/paypal
*
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the MIT License.
*
* See http://opensource.org/licenses/MIT
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* PlantUML can occasionally display sponsored or advertising messages. Those
* messages are usually generated on welcome or error images and never on
* functional diagrams.
* See https://plantuml.com/professional if you want to remove them
*
* Images (whatever their format : PNG, SVG, EPS...) generated by running PlantUML
* are owned by the author of their corresponding sources code (that is, their
* textual description in PlantUML language). Those images are not covered by
* this MIT license.
*
* The generated images can then be used without any reference to the MIT license.
* It is not even necessary to stipulate that they have been generated with PlantUML,
* although this will be appreciated by the PlantUML team.
*
* There is an exception : if the textual description in PlantUML language is also covered
* by any license, then the generated images are logically covered
* by the very same license.
*
* This is the IGY distribution (Install GraphViz by Yourself).
* You have to install GraphViz and to setup the GRAPHVIZ_DOT environment variable
* (see https://plantuml.com/graphviz-dot )
*
* Icons provided by OpenIconic : https://useiconic.com/open
* Archimate sprites provided by Archi : http://www.archimatetool.com
* Stdlib AWS provided by https://github.com/milo-minderbinder/AWS-PlantUML
* Stdlib Icons provided https://github.com/tupadr3/plantuml-icon-font-sprites
* ASCIIMathML (c) Peter Jipsen http://www.chapman.edu/~jipsen
* ASCIIMathML (c) David Lippman http://www.pierce.ctc.edu/dlippman
* CafeUndZopfli ported by Eugene Klyuchnikov https://github.com/eustas/CafeUndZopfli
* Brotli (c) by the Brotli Authors https://github.com/google/brotli
* Themes (c) by Brett Schwarz https://github.com/bschwarz/puml-themes
* Twemoji (c) by Twitter at https://twemoji.twitter.com/
*
*/
package net.sourceforge.plantuml.syntax;
import java.io.PrintStream;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import net.sourceforge.plantuml.klimt.color.HColorSet;
import net.sourceforge.plantuml.skin.SkinParam;
import net.sourceforge.plantuml.utils.Cypher;
public class LanguageDescriptor {
private final Set type = new TreeSet<>();
private final Set keyword = new TreeSet<>();
private final Set preproc = new TreeSet<>();
public LanguageDescriptor() {
addArobase("board");
addArobase("bpm");
addArobase("chen");
addArobase("chronology");
addArobase("creole");
addArobase("cute");
addArobase("def");
addArobase("ditaa");
addArobase("dot");
addArobase("ebnf");
addArobase("files");
addArobase("flow");
addArobase("gantt");
addArobase("git");
addArobase("hcl");
addArobase("jcckit");
addArobase("json");
addArobase("latex");
addArobase("math");
addArobase("mindmap");
addArobase("nwdiag");
addArobase("project");
addArobase("regex");
addArobase("salt");
addArobase("tree");
addArobase("uml");
addArobase("wbs");
addArobase("wire");
addArobase("yaml");
type.add("abstract");
type.add("action");
type.add("actor");
type.add("agent");
type.add("annotation");
type.add("archimate");
type.add("artifact");
type.add("boundary");
type.add("card");
type.add("class");
type.add("cloud");
type.add("collections");
type.add("component");
type.add("control");
type.add("database");
type.add("diamond");
type.add("entity");
type.add("enum");
type.add("exception");
type.add("file");
type.add("folder");
type.add("frame");
type.add("hexagon");
type.add("interface");
type.add("json");
type.add("label");
type.add("map");
type.add("metaclass");
type.add("node");
type.add("object");
type.add("package");
type.add("participant");
type.add("person");
type.add("process");
type.add("protocol");
type.add("queue");
type.add("rectangle");
type.add("relationship");
type.add("stack");
type.add("state");
type.add("storage");
type.add("struct");
type.add("usecase");
keyword.add("across");
keyword.add("activate");
keyword.add("again");
keyword.add("allow_mixing");
keyword.add("allowmixing");
keyword.add("also");
keyword.add("alt");
keyword.add("as");
keyword.add("attribute");
keyword.add("attributes");
keyword.add("autonumber");
keyword.add("bold");
keyword.add("bold");
keyword.add("bottom");
keyword.add("box");
keyword.add("break");
keyword.add("caption");
keyword.add("center");
keyword.add("circle");
keyword.add("circled");
keyword.add("circles");
keyword.add("color");
keyword.add("create");
keyword.add("critical");
keyword.add("dashed");
keyword.add("deactivate");
keyword.add("description");
keyword.add("destroy");
keyword.add("detach");
keyword.add("dotted");
keyword.add("down");
keyword.add("else");
keyword.add("else");
keyword.add("elseif");
keyword.add("empty");
keyword.add("end");
keyword.add("endcaption");
keyword.add("endfooter");
keyword.add("endheader");
keyword.add("endif");
keyword.add("endlegend");
keyword.add("endtitle");
keyword.add("endwhile");
keyword.add("false");
keyword.add("field");
keyword.add("fields");
keyword.add("footbox");
keyword.add("footer");
keyword.add("fork");
keyword.add("group");
keyword.add("header");
keyword.add("hide");
keyword.add("hnote");
keyword.add("if");
keyword.add("is");
keyword.add("italic");
keyword.add("kill");
keyword.add("left");
keyword.add("left to right direction");
keyword.add("legend");
keyword.add("link");
keyword.add("loop");
keyword.add("mainframe");
keyword.add("member");
keyword.add("members");
keyword.add("method");
keyword.add("methods");
keyword.add("namespace");
keyword.add("newpage");
keyword.add("normal");
keyword.add("note");
keyword.add("of");
keyword.add("on");
keyword.add("opt");
keyword.add("order");
keyword.add("over");
keyword.add("package");
keyword.add("page");
keyword.add("par");
keyword.add("partition");
keyword.add("plain");
keyword.add("private");
keyword.add("protected");
keyword.add("public");
keyword.add("ref");
keyword.add("repeat");
keyword.add("return");
keyword.add("right");
keyword.add("rnote");
keyword.add("rotate");
keyword.add("show");
keyword.add("skin");
keyword.add("skinparam");
keyword.add("split");
keyword.add("sprite");
keyword.add("start");
keyword.add("stereotype");
keyword.add("stereotypes");
keyword.add("stop");
keyword.add("style");
keyword.add("then");
keyword.add("title");
keyword.add("together");
keyword.add("top");
keyword.add("top to bottom direction");
keyword.add("true");
keyword.add("up");
keyword.add("while");
preproc.add("!assert");
preproc.add("!define");
preproc.add("!definelong");
preproc.add("!dump_memory");
preproc.add("!else");
preproc.add("!enddefinelong");
preproc.add("!endfunction");
preproc.add("!endif");
preproc.add("!endprocedure");
preproc.add("!endsub");
preproc.add("!exit");
preproc.add("!function");
preproc.add("!if");
preproc.add("!ifdef");
preproc.add("!ifndef");
preproc.add("!import");
preproc.add("!include");
preproc.add("!local");
preproc.add("!log");
preproc.add("!pragma");
preproc.add("!procedure");
preproc.add("!return");
preproc.add("!startsub");
preproc.add("!theme");
preproc.add("!undef");
preproc.add("!unquoted");
}
private void addArobase(String type) {
keyword.add("@start" + type);
keyword.add("@end" + type);
}
public Cypher getCypher() {
final Cypher cypher = new Cypher();
for (String s : type)
cypher.addException(s);
for (String s : keyword)
cypher.addException(s.replace("@", ""));
for (String s : preproc)
cypher.addException(s.substring(1));
for (String s : SkinParam.getPossibleValues())
cypher.addException(s);
for (String s : HColorSet.instance().names())
cypher.addException(s);
cypher.addException("o");
return cypher;
}
public void print(PrintStream ps) {
print(ps, "type", type);
print(ps, "keyword", keyword);
print(ps, "preprocessor", preproc);
print(ps, "skinparameter", SkinParam.getPossibleValues());
print(ps, "color", HColorSet.instance().names());
ps.println(";EOF");
}
private static void print(PrintStream ps, String name, Collection data) {
ps.println(";" + name);
ps.println(";" + data.size());
for (String k : data)
ps.println(k);
ps.println();
}
public final Set getType() {
return Collections.unmodifiableSet(type);
}
public final Set getKeyword() {
return Collections.unmodifiableSet(keyword);
}
public final Set getPreproc() {
return Collections.unmodifiableSet(preproc);
}
public static void main(String[] args) {
LanguageDescriptor languageDescriptor = new LanguageDescriptor();
for (String s : languageDescriptor.type) {
System.out.print(s);
System.out.print("|");
}
System.out.println();
for (String s : languageDescriptor.keyword) {
if (s.startsWith("@"))
continue;
System.out.print(s);
System.out.print("|");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy