Skip to content

Commit

Permalink
Rewrite with reference to component-reference in the grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 18, 2023
1 parent 148e1bd commit 46130eb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions chapters/annotations.tex
Expand Up @@ -1069,18 +1069,19 @@ \subsubsection{Text}\label{text}
\item
\%class replaced by the name of the class (only the last part of the hierarchical name).
\item
\%\emph{par} and \%\{\emph{par\}} replaced by the value of the parameter \lstinline!par!.
\%\emph{par} and \%\{\emph{par}\} replaced by the value of the parameter \lstinline!par!.
If the value is numeric, tools shall display the value with \lstinline!displayUnit!, formatted according to the BIPM specification.
E.g., for
\begin{lstlisting}[language=modelica]
parameter Real t(unit = "s", displayUnit = "ms") = 0.1
\end{lstlisting}
tools shall display \emph{100 ms}.
The intent is that the text is easily readable, thus if \lstinline!par! is of an enumeration type, replace \lstinline!%par! by the item name, not by the full name.
The intent is that the text is easily readable, thus if \lstinline!par! is of an enumeration type, replace \%\emph{par} by the item name, not by the full name.
\begin{example}
If \lstinline!par = "Modelica.Blocks.Types.Enumeration.Periodic"!, then \lstinline!%par! should be displayed as \emph{Periodic}.
If \lstinline!par = "Modelica.Blocks.Types.Enumeration.Periodic"!, then \%\emph{par} should be displayed as \emph{Periodic}.
\end{example}
The form \%\{\emph{par\}} allows component references and is required for quoted identifiers, and can be directly followed by a letter.
When quoted identifiers are involved, the form \%\{\emph{par}\} must be used.
Here, \emph{par} is a general \lstinline[language=grammar]!component-reference!, and the macro can be directly followed by a letter.
Thus \lstinline!%{w}x%{h}! gives the value of \lstinline!w! directly followed by \emph{x} and the value of \lstinline!h!, while \lstinline!%wxh! gives the value of the parameter \lstinline!wxh!.
If the parameter does not exist it is an error.
\end{itemize}
Expand Down

0 comments on commit 46130eb

Please sign in to comment.