All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.plantuml.syntax.LanguageDescriptor Maven / Gradle / Ivy

// 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 Revised BSD License.
 *
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * * Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * * Neither the name of the University of California, Berkeley nor the
 *   names of its contributors may be used to endorse or promote products
 *   derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * 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 BSD license.
 *
 * The generated images can then be used without any reference to the BSD 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() {

		type.add("actor");
		type.add("participant");
		type.add("usecase");
		type.add("class");
		type.add("interface");
		type.add("abstract");
		type.add("enum");
		type.add("component");
		type.add("state");
		type.add("object");
		type.add("artifact");
		type.add("folder");
		type.add("rectangle");
		type.add("node");
		type.add("frame");
		type.add("cloud");
		type.add("database");
		type.add("storage");
		type.add("agent");
		type.add("stack");
		type.add("boundary");
		type.add("control");
		type.add("entity");
		type.add("card");
		type.add("file");
		type.add("package");
		type.add("queue");
		type.add("archimate");
		type.add("diamond");
		type.add("collections");
		type.add("hexagon");
		type.add("label");
		type.add("person");
		type.add("annotation");
		type.add("protocol");
		type.add("struct");
		type.add("exception");
		type.add("metaclass");
		type.add("map");
		type.add("json");
		type.add("action");
		type.add("process");
		type.add("relationship");

		keyword.add("@startwire");
		keyword.add("@startbpm");
		keyword.add("@startuml");
		keyword.add("@startdot");
		keyword.add("@startjcckit");
		keyword.add("@startditaa");
		keyword.add("@startproject");
		keyword.add("@startsalt");
		keyword.add("@startflow");
		keyword.add("@startcreole");
		keyword.add("@starttree");
		keyword.add("@startcute");
		keyword.add("@startmath");
		keyword.add("@startlatex");
		keyword.add("@startdef");
		keyword.add("@startgantt");
		keyword.add("@startnwdiag");
		keyword.add("@startmindmap");
		keyword.add("@startwbs");
		keyword.add("@startjson");
		keyword.add("@startgit");
		keyword.add("@startboard");
		keyword.add("@startyaml");
		keyword.add("@starthcl");
		keyword.add("@startebnf");
		keyword.add("@startregex");
		keyword.add("@startfiles");
		keyword.add("@startchronology");
		keyword.add("@startchen");
		keyword.add("@endwire");
		keyword.add("@endbpm");
		keyword.add("@enduml");
		keyword.add("@enddot");
		keyword.add("@endjcckit");
		keyword.add("@endditaa");
		keyword.add("@endproject");
		keyword.add("@endsalt");
		keyword.add("@endflow");
		keyword.add("@endcreole");
		keyword.add("@endtree");
		keyword.add("@endcute");
		keyword.add("@endmath");
		keyword.add("@endlatex");
		keyword.add("@enddef");
		keyword.add("@endgantt");
		keyword.add("@endnwdiag");
		keyword.add("@endmindmap");
		keyword.add("@endwbs");
		keyword.add("@endjson");
		keyword.add("@endgit");
		keyword.add("@endboard");
		keyword.add("@endyaml");
		keyword.add("@endhcl");
		keyword.add("@endebnf");
		keyword.add("@endregex");
		keyword.add("@endfiles");
		keyword.add("@endchronology");
		keyword.add("@endchen");
		keyword.add("as");
		keyword.add("also");
		keyword.add("autonumber");
		keyword.add("caption");
		keyword.add("endcaption");
		keyword.add("title");
		keyword.add("endtitle");
		keyword.add("newpage");
		keyword.add("box");
		keyword.add("alt");
		keyword.add("else");
		keyword.add("opt");
		keyword.add("loop");
		keyword.add("par");
		keyword.add("break");
		keyword.add("critical");
		keyword.add("note");
		keyword.add("rnote");
		keyword.add("hnote");
		keyword.add("legend");
		keyword.add("endlegend");
		keyword.add("group");
		keyword.add("left");
		keyword.add("right");
		keyword.add("of");
		keyword.add("on");
		keyword.add("link");
		keyword.add("over");
		keyword.add("end");
		keyword.add("activate");
		keyword.add("deactivate");
		keyword.add("destroy");
		keyword.add("create");
		keyword.add("footbox");
		keyword.add("hide");
		keyword.add("show");
		keyword.add("skinparam");
		keyword.add("skin");
		keyword.add("top");
		keyword.add("bottom");
		keyword.add("top to bottom direction");
		keyword.add("left to right direction");
		keyword.add("package");
		keyword.add("namespace");
		keyword.add("page");
		keyword.add("up");
		keyword.add("down");
		keyword.add("if");
		keyword.add("then");
		keyword.add("else");
		keyword.add("elseif");
		keyword.add("endif");
		keyword.add("partition");
		keyword.add("footer");
		keyword.add("endfooter");
		keyword.add("header");
		keyword.add("endheader");
		keyword.add("center");
		keyword.add("rotate");
		keyword.add("ref");
		keyword.add("return");
		keyword.add("is");
		keyword.add("repeat");
		keyword.add("start");
		keyword.add("stop");
		keyword.add("while");
		keyword.add("endwhile");
		keyword.add("fork");
		keyword.add("again");
		keyword.add("kill");
		keyword.add("detach");
		keyword.add("order");
		keyword.add("allow_mixing");
		keyword.add("allowmixing");
		keyword.add("mainframe");
		keyword.add("across");
		keyword.add("stereotype");
		keyword.add("stereotypes");
		keyword.add("split");
		keyword.add("style");
		keyword.add("sprite");
		keyword.add("circle");
		keyword.add("circles");
		keyword.add("circled");
		keyword.add("empty");
		keyword.add("member");
		keyword.add("members");
		keyword.add("description");
		keyword.add("true");
		keyword.add("false");
		keyword.add("normal");
		keyword.add("italic");
		keyword.add("bold");
		keyword.add("plain");
		keyword.add("color");
		keyword.add("dotted");
		keyword.add("dashed");
		keyword.add("bold");
		keyword.add("together");
		keyword.add("attribute");
		keyword.add("attributes");
		keyword.add("field");
		keyword.add("fields");
		keyword.add("method");
		keyword.add("methods");
		keyword.add("public");
		keyword.add("private");
		keyword.add("protected");

		preproc.add("!exit");
		preproc.add("!include");
		preproc.add("!theme");
		preproc.add("!pragma");
		preproc.add("!define");
		preproc.add("!undef");
		preproc.add("!if");
		preproc.add("!ifdef");
		preproc.add("!endif");
		preproc.add("!ifndef");
		preproc.add("!else");
		preproc.add("!definelong");
		preproc.add("!enddefinelong");
		preproc.add("!function");
		preproc.add("!procedure");
		preproc.add("!endfunction");
		preproc.add("!endprocedure");
		preproc.add("!unquoted");
		preproc.add("!return");
		preproc.add("!startsub");
		preproc.add("!endsub");
		preproc.add("!assert");
		preproc.add("!log");
		preproc.add("!local");
		preproc.add("!dump_memory");
		preproc.add("!import");
	}

	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);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy