Skip to content

Commit

Permalink
Clean up non-normative content in lexicalstructure.tex
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Apr 23, 2020
1 parent 067e948 commit 43537f3
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions chapters/lexicalstructure.tex
Expand Up @@ -26,16 +26,18 @@ \section{Comments}\doublelabel{comments}
translator. The whitespace characters are space, tabulator, and line
separators (carriage return and line feed); and whitespace cannot occur
inside tokens, e.g., \textless{}= must be written as two characters
without space or comments between them. {[}\emph{The comment syntax is
identical to that of C++}{]}. The following comment variants are
without space or comments between them. The following comment variants are
available:

%TODO-FORMAT should be a table instead of lstlisting?
\begin{lstlisting}[language=modelica]
// comment & Characters from // to the end of the line are ignored.
/* comment */ & Characters between /* and */ are ignored, including line terminators.
\end{lstlisting}

\begin{nonnormative}
The comment syntax is identical to that of C++.
\end{nonnormative}

Modelica comments do not nest, i.e., /* */ cannot be embedded within /*
*/. The following is \emph{invalid}:
\begin{lstlisting}[language=modelica]
Expand Down Expand Up @@ -161,11 +163,14 @@ \subsection{Floating Point Numbers}\doublelabel{floating-point-numbers}
\subsection{Integer Literals}\doublelabel{integer-literals}

Literals of type \lstinline!Integer! are sequences of decimal digits, e.g. as in the
integer numbers \lstinline!33!, \lstinline!0!, \lstinline!100!, \lstinline!30030044!. {[}\emph{Negative numbers are
formed by unary minus followed by an integer literal}{]}. The minimal
integer numbers \lstinline!33!, \lstinline!0!, \lstinline!100!, \lstinline!30030044!. The minimal
recommended number range is from -2147483648 to +2147483647 corresponding to a
two's-complement 32-bit integer implementation.

\begin{nonnormative}
Negative numbers are formed by unary minus followed by an integer literal.
\end{nonnormative}

\subsection{Boolean Literals}\doublelabel{boolean-literals}

The two \lstinline!Boolean! literal values are \lstinline!true! and \lstinline!false!.
Expand Down Expand Up @@ -209,24 +214,24 @@ \subsection{Strings}\doublelabel{strings}

The \lstinline!"\n"! character is used to conceptually indicate the
end of a line within a Modelica string. Any Modelica program that needs
to recognize line endings can check for a single
\lstinline!"\n"!
to recognize line endings can check for a single \lstinline!"\n"!
character to do so on any platform. It is the responsibility of a
Modelica implementation to make any necessary transformations to other
representations when writing to or reading from a text file.
{[}\emph{For example, a} \lstinline!"\n"! \emph{is written and read as-is in
a Unix or Linux implementation, but written as}
\lstinline!"\r\n"! \emph{pair, and converted back to}
\lstinline!"\n"! \emph{when read, in a Windows implementation.}{]}

{[}\emph{For long string comments, e.g., the \lstinline!info! annotation to
\begin{nonnormative}
For example, a \lstinline!"\n"! is written and read as-is in a Unix or Linux implementation, but written as
\lstinline!"\r\n"! pair, and converted back to \lstinline!"\n"! when read in a Windows implementation.
\end{nonnormative}

\begin{nonnormative}
For long string comments, e.g., the \lstinline!info! annotation to
store the documentation of a model, it would be very inconvenient, if
the string concatenation operator would have to be used for every line
of documentation. It is assumed that a Modelica tool supports the
non-printable newline character when browsing or editing a string
literal. For example, the following statement defines one string that
contains (non-printable) newline characters:}

contains (non-printable) newline characters:
\begin{lstlisting}[language=modelica]
assert(noEvent(length > s_small), "
The distance between the origin of frame_a and the origin of frame_b
Expand All @@ -237,7 +242,8 @@ \subsection{Strings}\doublelabel{strings}
when computing the direction of the line force.",
level = AssertionLevel.warning);
\end{lstlisting}
]
\end{nonnormative}

\section{Operator Symbols}\doublelabel{operator-symbols}

The predefined operator symbols are formally defined on page \pageref{lexical-conventions} and
Expand Down

0 comments on commit 43537f3

Please sign in to comment.