diff --git a/chapters/lexicalstructure.tex b/chapters/lexicalstructure.tex index 105901a62..35d3d5775 100644 --- a/chapters/lexicalstructure.tex +++ b/chapters/lexicalstructure.tex @@ -117,18 +117,18 @@ \subsection{Modelica Keywords}\label{modelica-keywords} The following Modelica \firstuse[keyword]{keywords} are reserved words that cannot be used where \lstinline[language=grammar]!IDENT! is expected in the language grammar (\cref{modelica-concrete-syntax}): \begin{center} \begin{tabular}{l l l l l} -{\lstinline!algorithm!} & {\lstinline!discrete!} & {\lstinline!false!} & {\lstinline!loop!} & {\lstinline!pure!}\\ \hline -{\lstinline!and!} & {\lstinline!each!} & {\lstinline!final!} & {\lstinline!model!} & {\lstinline!record!}\\ \hline -{\lstinline!annotation!} & {\lstinline!else!} & {\lstinline!flow!} & {\lstinline!not!} & {\lstinline!redeclare!}\\ \hline -& {\lstinline!elseif!} & {\lstinline!for!} & {\lstinline!operator!} & {\lstinline!replaceable!}\\ \hline +{\lstinline!algorithm!} & {\lstinline!each!} & {\lstinline!final!} & {\lstinline!model!} & {\lstinline!record!}\\ \hline +{\lstinline!and!} & {\lstinline!else!} & {\lstinline!flow!} & {\lstinline!not!} & {\lstinline!redeclare!}\\ \hline +{\lstinline!annotation!} & {\lstinline!elseif!} & {\lstinline!for!} & {\lstinline!operator!} & {\lstinline!replaceable!}\\ \hline {\lstinline!block!} & {\lstinline!elsewhen!} & {\lstinline!function!} & {\lstinline!or!} & {\lstinline!return!}\\ \hline {\lstinline!break!} & {\lstinline!encapsulated!} & {\lstinline!if!} & {\lstinline!outer!} & {\lstinline!stream!}\\ \hline {\lstinline!class!} & {\lstinline!end!} & {\lstinline!import!} & {\lstinline!output!} & {\lstinline!then!}\\ \hline -{\lstinline!connect!} & {\lstinline!enumeration!} & {\lstinline!impure!} & {\lstinline!package!} & {\lstinline!true!}\\ \hline -{\lstinline!connector!} & {\lstinline!equation!} & {\lstinline!in!} & {\lstinline!parameter!} & {\lstinline!type!}\\ \hline -{\lstinline!constant!} & {\lstinline!expandable!} & {\lstinline!initial!} & {\lstinline!partial!} & {\lstinline!when!}\\ \hline -{\lstinline!constrainedby!} & {\lstinline!extends!} & {\lstinline!inner!} & {\lstinline!protected!} & {\lstinline!while!}\\ \hline -{\lstinline!der!} & {\lstinline!external!} & {\lstinline!input!} & {\lstinline!public!} & {\lstinline!within!}\\ +{\lstinline!connect!} & {\lstinline!enumeration!} & {\lstinline!impure!} & {\lstinline!package!} & {\lstinline!time!}\\ \hline +{\lstinline!connector!} & {\lstinline!equation!} & {\lstinline!in!} & {\lstinline!parameter!} & {\lstinline!true!}\\ \hline +{\lstinline!constant!} & {\lstinline!expandable!} & {\lstinline!initial!} & {\lstinline!partial!} & {\lstinline!type!}\\ \hline +{\lstinline!constrainedby!} & {\lstinline!extends!} & {\lstinline!inner!} & {\lstinline!protected!} & {\lstinline!when!}\\ \hline +{\lstinline!der!} & {\lstinline!external!} & {\lstinline!input!} & {\lstinline!public!} & {\lstinline!while!}\\ \hline +{\lstinline!discrete!} & {\lstinline!false!} & {\lstinline!loop!} & {\lstinline!pure!} & {\lstinline!within!}\\ \end{tabular} \end{center} diff --git a/chapters/operatorsandexpressions.tex b/chapters/operatorsandexpressions.tex index 125b248f9..350ff2773 100644 --- a/chapters/operatorsandexpressions.tex +++ b/chapters/operatorsandexpressions.tex @@ -359,8 +359,8 @@ \subsection{Member Access Operator}\label{member-access-operator} \subsection{Built-in Variable time}\label{built-in-variable-time}\indexinline{time} -All declared variables are functions of the independent variable \lstinline!time!. -The variable \lstinline!time! is a built-in variable available in all models and blocks, which is treated as an input variable. +All declared variables are functions of \lstinline!time!. +The name \lstinline!time! is a keyword (see \cref{modelica-keywords}), and corresponds to a built-in variable available in all models and blocks, which is treated as an input variable. It is implicitly defined as: \begin{lstlisting}[language=modelica] input Real time (final quantity = "Time", diff --git a/chapters/syntax.tex b/chapters/syntax.tex index 843060257..fa5414aab 100644 --- a/chapters/syntax.tex +++ b/chapters/syntax.tex @@ -411,6 +411,7 @@ \subsection{Expressions}\label{expressions1} | STRING | false | true + | time | ( component-reference | der | initial | pure ) function-call-args | component-reference | "(" output-expression-list ")" [ ( array-subscripts | "." IDENT ) ] @@ -432,7 +433,8 @@ \subsection{Expressions}\label{expressions1} result-reference : component-reference - | der "(" component-reference [ "," UNSIGNED-INTEGER ] ")" + | time + | der "(" ( component-reference | time ) [ "," UNSIGNED-INTEGER ] ")" function-call-args : "(" [ function-arguments ] ")" diff --git a/mlslistings.sty b/mlslistings.sty index 72718ad43..338ec766d 100644 --- a/mlslistings.sty +++ b/mlslistings.sty @@ -53,7 +53,7 @@ % otherkeywords={-, =, +, [, ], (, ), \{, \}, :, *, !},% morekeywords=[1]{% Keywords not used to define code structure der,connect,assert,terminate,break,return,% - false,true,and,not,or,% + time,false,true,and,not,or,% final,each,% flow,stream,% input,output,%