lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.target.Target Enum Reference

Enumeration of targets and their associated properties. More...

Public Member Functions

boolean allowsBracedListExpressions ()
 Allow expressions of the form {a, b, c}.
boolean allowsBracketListExpressions ()
 Allow expressions of the form [a, b, c].
boolean allowsParenthesisListExpressions ()
 Allow expressions of the form (a, b, c).
String getDirectoryName ()
 Return the conventional directory name for this target.
String getDisplayName ()
 Return the display name of the target, as it should be written in LF code.
String getSingleLineCommentPrefix ()
 Return a string that demarcates the beginning of a single-line comment.
void initialize (TargetConfig config)
boolean isReservedIdent (String ident)
 Return whether the given identifier is invalid as the name of an LF construct.
boolean mandatesEqualsInitializers ()
 Whether the target requires using an equal sign to assign a default value to a parameter, or initialize a state variable.
boolean setsKeepAliveOptionAutomatically ()
 Return true if the keepalive option is set automatically for this target if physical actions are detected in the program (and keepalive was not explicitly unset by the user).
boolean supportsEnclaves ()
 Return true if enclaves are supported by this target.
boolean supportsFederated ()
 Return true if the target supports federated execution.
boolean supportsInheritance ()
 Return true if the target supports reactor inheritance (extends keyword).
boolean supportsMultiports ()
 Return true if the target supports multiports and banks of reactors.
boolean supportsParameterizedWidths ()
 Return true if the target supports widths of banks and multiports that depend on reactor parameters (not only on constants).
boolean supportsReactionDeclarations ()
 Return true if reaction declarations (i.e., reactions without inlined code) are supported by this target.
 Target (String displayName, boolean requiresTypes, Collection< String > keywords)
 Private constructor for targets.
String toString ()
 Return the description.

Static Public Member Functions

static Optional< TargetforName (String name)
 Return the target whose display name is the given string (modulo character case), or an empty optional if there is no such target.
static Target fromDecl (TargetDecl targetDecl)
 Return the target constant corresponding to given target declaration among.
static< T > T match (final String string, final Iterable< T > candidates)
 Given a string and a list of candidate objects, return the first candidate that matches, or null if no candidate matches.
static< T > T match (final String string, final T[] candidates)
 Given a string and a list of candidate objects, return the first candidate that matches, or null if no candidate matches.

Public Attributes

 C
 CCPP =("CCpp", true, Target.C.keywords)
 CPP
 Python
final boolean requiresTypes
 Whether or not this target requires types.
 Rust
 TS
 UC =("uC", true, Target.C.keywords)

Static Public Attributes

static final List< TargetALL = List.of(Target.values())
 An unmodifiable list of all known targets.

Detailed Description

Enumeration of targets and their associated properties.

Author
Marten Lohstroh

Constructor & Destructor Documentation

◆ Target()

org.lflang.target.Target.Target ( String displayName,
boolean requiresTypes,
Collection< String > keywords )

Private constructor for targets.

Parameters
displayNameString representation of this target.
requiresTypesTypes Whether this target requires type annotations or not.
keywordsList of reserved strings in the target language.

Member Function Documentation

◆ allowsBracedListExpressions()

boolean org.lflang.target.Target.allowsBracedListExpressions ( )

Allow expressions of the form {a, b, c}.

◆ allowsBracketListExpressions()

boolean org.lflang.target.Target.allowsBracketListExpressions ( )

Allow expressions of the form [a, b, c].

◆ allowsParenthesisListExpressions()

boolean org.lflang.target.Target.allowsParenthesisListExpressions ( )

Allow expressions of the form (a, b, c).

◆ forName()

Optional< Target > org.lflang.target.Target.forName ( String name)
static

Return the target whose display name is the given string (modulo character case), or an empty optional if there is no such target.

◆ fromDecl()

Target org.lflang.target.Target.fromDecl ( TargetDecl targetDecl)
static

Return the target constant corresponding to given target declaration among.

Return a non-null result, will throw if invalid.

Exceptions
RuntimeExceptionIf no target declaration (TargetDecl) is present or if it is invalid.

◆ getDirectoryName()

String org.lflang.target.Target.getDirectoryName ( )

Return the conventional directory name for this target.

This is used to divide e.g. the test and example directories by target language. For instance, test/Cpp is the path of CPP's test directory, and this method returns "Cpp".

◆ getDisplayName()

String org.lflang.target.Target.getDisplayName ( )

Return the display name of the target, as it should be written in LF code.

This is hence a single identifier. Eg for CPP returns "Cpp", for Python returns "Python". Avoid using either name() or toString(), which have unrelated contracts.

◆ getSingleLineCommentPrefix()

String org.lflang.target.Target.getSingleLineCommentPrefix ( )

Return a string that demarcates the beginning of a single-line comment.

◆ initialize()

void org.lflang.target.Target.initialize ( TargetConfig config)

◆ isReservedIdent()

boolean org.lflang.target.Target.isReservedIdent ( String ident)

Return whether the given identifier is invalid as the name of an LF construct.

This usually means that the identifier is a keyword in the target language. In Rust, many keywords may be escaped with the syntax r#keyword, and they are considered valid identifiers.

◆ mandatesEqualsInitializers()

boolean org.lflang.target.Target.mandatesEqualsInitializers ( )

Whether the target requires using an equal sign to assign a default value to a parameter, or initialize a state variable.

All targets mandate an equal sign when passing arguments to a reactor constructor call, regardless of this method.

◆ match() [1/2]

static< T > T org.lflang.target.Target.match ( final String string,
final Iterable< T > candidates )
static

Given a string and a list of candidate objects, return the first candidate that matches, or null if no candidate matches.

todo move to CollectionUtil (introduced in #442)

Parameters
stringThe string to match against candidates.
candidatesThe candidates to match the string against.

◆ match() [2/2]

static< T > T org.lflang.target.Target.match ( final String string,
final T[] candidates )
static

Given a string and a list of candidate objects, return the first candidate that matches, or null if no candidate matches.

todo move to CollectionUtil (introduced in #442)

Parameters
stringThe string to match against candidates.
candidatesThe candidates to match the string against.

◆ setsKeepAliveOptionAutomatically()

boolean org.lflang.target.Target.setsKeepAliveOptionAutomatically ( )

Return true if the keepalive option is set automatically for this target if physical actions are detected in the program (and keepalive was not explicitly unset by the user).

◆ supportsEnclaves()

boolean org.lflang.target.Target.supportsEnclaves ( )

Return true if enclaves are supported by this target.

◆ supportsFederated()

boolean org.lflang.target.Target.supportsFederated ( )

Return true if the target supports federated execution.

◆ supportsInheritance()

boolean org.lflang.target.Target.supportsInheritance ( )

Return true if the target supports reactor inheritance (extends keyword).

◆ supportsMultiports()

boolean org.lflang.target.Target.supportsMultiports ( )

Return true if the target supports multiports and banks of reactors.

◆ supportsParameterizedWidths()

boolean org.lflang.target.Target.supportsParameterizedWidths ( )

Return true if the target supports widths of banks and multiports that depend on reactor parameters (not only on constants).

◆ supportsReactionDeclarations()

boolean org.lflang.target.Target.supportsReactionDeclarations ( )

Return true if reaction declarations (i.e., reactions without inlined code) are supported by this target.

◆ toString()

String org.lflang.target.Target.toString ( )

Return the description.

Avoid depending on this, toString is supposed to be debug information. Prefer getDisplayName().

Member Data Documentation

◆ ALL

final List<Target> org.lflang.target.Target.ALL = List.of(Target.values())
static

An unmodifiable list of all known targets.

◆ C

org.lflang.target.Target.C
Initial value:
=(
"C",
true,
Arrays.asList(
"auto",
"break",
"case",
"char",
"const",
"continue",
"default",
"do",
"double",
"else",
"enum",
"extern",
"float",
"for",
"goto",
"if",
"inline",
"int",
"long",
"register",
"restrict",
"return",
"short",
"signed",
"sizeof",
"static",
"struct",
"switch",
"typedef",
"union",
"unsigned",
"void",
"volatile",
"while",
"_Alignas",
"_Alignof",
"_Atomic",
"_Bool",
"_Complex",
"_Generic",
"_Imaginary",
"_Noreturn",
"_Static_assert",
"_Thread_local"
))

◆ CCPP

org.lflang.target.Target.CCPP =("CCpp", true, Target.C.keywords)

◆ CPP

org.lflang.target.Target.CPP
Initial value:
=(
"Cpp",
true,
Arrays.asList(
"alignas",
"alignof",
"and",
"and_eq",
"asm",
"atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto(1)",
"bitand",
"bitor",
"bool",
"break",
"case",
"catch",
"char",
"char8_t",
"char16_t",
"char32_t",
"class(1)",
"compl",
"concept",
"const",
"consteval",
"constexpr",
"constinit",
"const_cast",
"continue",
"co_await",
"co_return",
"co_yield",
"decltype",
"default(1)",
"delete(1)",
"do",
"double",
"dynamic_cast",
"else",
"enum",
"explicit",
"export(1)(3)",
"extern(1)",
"false",
"float",
"for",
"friend",
"goto",
"if",
"inline(1)",
"int",
"long",
"mutable(1)",
"namespace",
"new",
"noexcept",
"not",
"not_eq",
"nullptr",
"operator",
"or",
"or_eq",
"private",
"protected",
"public",
"reflexpr",
"register(2)",
"reinterpret_cast",
"requires",
"return",
"short",
"signed",
"sizeof(1)",
"static",
"static_assert",
"static_cast",
"struct(1)",
"switch",
"synchronized",
"template",
"this",
"thread_local",
"throw",
"true",
"try",
"typedef",
"typeid",
"typename",
"union",
"unsigned",
"using(1)",
"virtual",
"void",
"volatile",
"wchar_t",
"while",
"xor",
"xor_eq"))

◆ Python

org.lflang.target.Target.Python
Initial value:
=(
"Python",
false,
Arrays.asList(
"and",
"as",
"assert",
"auto",
"break",
"case",
"char",
"class",
"const",
"continue",
"def",
"default",
"del",
"do",
"double",
"elif",
"else",
"enum",
"except",
"extern",
"False",
"finally",
"float",
"for",
"from",
"global",
"goto",
"if",
"import",
"inline",
"int",
"in",
"is",
"lambda",
"long",
"None",
"nonlocal",
"not",
"or",
"pass",
"raise",
"register",
"restrict",
"return",
"short",
"signed",
"sizeof",
"static",
"struct",
"switch",
"True",
"try",
"typedef",
"union",
"unsigned",
"void",
"volatile",
"while",
"with",
"yield",
"_Alignas",
"_Alignof",
"_Atomic",
"_Bool",
"_Complex",
"_Generic",
"_Imaginary",
"_Noreturn",
"_Static_assert",
"_Thread_local"
))

◆ requiresTypes

final boolean org.lflang.target.Target.requiresTypes

Whether or not this target requires types.

◆ Rust

org.lflang.target.Target.Rust
Initial value:
=(
"Rust",
true,
Arrays.asList("self", "true", "false"))

◆ TS

org.lflang.target.Target.TS
Initial value:
=(
"TypeScript",
false,
Arrays.asList(
"break",
"case",
"catch",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"else",
"enum",
"export",
"extends",
"false",
"finally",
"for",
"function",
"if",
"import",
"in",
"instanceof",
"new",
"null",
"return",
"super",
"switch",
"this",
"throw",
"true",
"try",
"typeof",
"var",
"void",
"while",
"with",
"as",
"implements",
"interface",
"let",
"package",
"private",
"protected",
"public",
"static",
"yield",
"any",
"boolean",
"constructor",
"declare",
"get",
"module",
"require",
"number",
"set",
"string",
"symbol",
"type",
"from",
"of",
"TimeUnit",
"TimeValue",
"Sched",
"Read",
"Write",
"ReadWrite"))

◆ UC

org.lflang.target.Target.UC =("uC", true, Target.C.keywords)

The documentation for this enum was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/target/Target.java