2018-09-20 11:12:14 +00:00
|
|
|
\def\builtinId#1{\textsf{\textbf{#1}}}
|
|
|
|
\def\keyword#1{\textsf{\textbf{#1}}}
|
2016-11-09 12:21:39 +00:00
|
|
|
\def\metavar#1{\ensuremath{\mathit{#1}}}
|
2017-01-06 12:53:28 +00:00
|
|
|
|
2016-11-09 12:21:39 +00:00
|
|
|
\def\ABSTRACT{\builtinId{abstract}}
|
|
|
|
\def\AS{\builtinId{as}}
|
2017-03-02 12:41:37 +00:00
|
|
|
\def\COVARIANT{\builtinId{covariant}}
|
2017-01-06 12:53:28 +00:00
|
|
|
\def\DEFERRED{\builtinId{deferred}}
|
|
|
|
\def\DYNAMIC{\builtinId{dynamic}}
|
|
|
|
\def\EXPORT{\builtinId{export}}
|
|
|
|
\def\EXTERNAL{\builtinId{external}}
|
|
|
|
\def\FACTORY{\builtinId{factory}}
|
2018-02-19 14:47:48 +00:00
|
|
|
\def\FUNCTION{\builtinId{Function}}
|
2017-01-06 12:53:28 +00:00
|
|
|
\def\GET{\builtinId{get}}
|
|
|
|
\def\IMPLEMENTS{\builtinId{implements}}
|
|
|
|
\def\IMPORT{\builtinId{import}}
|
2018-05-16 19:09:52 +00:00
|
|
|
\def\INTERFACE{\builtinId{interface}}
|
2017-01-06 12:53:28 +00:00
|
|
|
\def\LIBRARY{\builtinId{library}}
|
2018-05-16 19:09:52 +00:00
|
|
|
\def\MIXIN{\builtinId{mixin}}
|
2017-01-06 12:53:28 +00:00
|
|
|
\def\OPERATOR{\builtinId{operator}}
|
|
|
|
\def\PART{\builtinId{part}}
|
|
|
|
\def\SET{\builtinId{set}}
|
|
|
|
\def\STATIC{\builtinId{static}}
|
|
|
|
\def\TYPEDEF{\builtinId{typedef}}
|
|
|
|
|
2016-11-09 12:21:39 +00:00
|
|
|
\def\ASSERT{\keyword{assert}}
|
|
|
|
\def\ASYNC{\keyword{async}}
|
|
|
|
\def\AWAIT{\keyword{await}}
|
|
|
|
\def\BREAK{\keyword{break}}
|
2017-01-06 12:53:28 +00:00
|
|
|
\def\CASE{\keyword{case}}
|
2016-11-09 12:21:39 +00:00
|
|
|
\def\CATCH{\keyword{catch}}
|
2017-01-06 12:53:28 +00:00
|
|
|
\def\CLASS{\keyword{class}}
|
2016-11-09 12:21:39 +00:00
|
|
|
\def\CONST{\keyword{const}}
|
|
|
|
\def\CONTINUE{\keyword{continue}}
|
|
|
|
\def\DEFAULT{\keyword{default}}
|
|
|
|
\def\DO{\keyword{do}}
|
|
|
|
\def\ELSE{\keyword{else}}
|
|
|
|
\def\ENUM{\keyword{enum}}
|
|
|
|
\def\EXTENDS{\keyword{extends}}
|
|
|
|
\def\FALSE{\keyword{false}}
|
|
|
|
\def\FINAL{\keyword{final}}
|
|
|
|
\def\FINALLY{\keyword{finally}}
|
|
|
|
\def\FOR{\keyword{for}}
|
|
|
|
\def\HIDE{\keyword{hide}}
|
|
|
|
\def\IF{\keyword{if}}
|
|
|
|
\def\IN{\keyword{in}}
|
|
|
|
\def\IS{\keyword{is}}
|
|
|
|
\def\NEW{\keyword{new}}
|
|
|
|
\def\NULL{\keyword{null}}
|
|
|
|
\def\OF{\keyword{of}}
|
2017-01-06 12:53:28 +00:00
|
|
|
\def\ON{\keyword{on}}
|
2016-11-09 12:21:39 +00:00
|
|
|
\def\RETHROW{\keyword{rethrow}}
|
|
|
|
\def\RETURN{\keyword{return}}
|
|
|
|
\def\SHOW{\keyword{show}}
|
|
|
|
\def\SUPER{\keyword{super}}
|
|
|
|
\def\SWITCH{\keyword{switch}}
|
|
|
|
\def\SYNC{\keyword{sync}}
|
|
|
|
\def\THIS{\keyword{this}}
|
|
|
|
\def\THROW{\keyword{throw}}
|
|
|
|
\def\TRUE{\keyword{true}}
|
|
|
|
\def\TRY{\keyword{try}}
|
|
|
|
\def\VAR{\keyword{var}}
|
|
|
|
\def\VOID{\keyword{void}}
|
|
|
|
\def\WHILE{\keyword{while}}
|
|
|
|
\def\WITH{\keyword{with}}
|
|
|
|
\def\YIELD{\keyword{yield}}
|
2013-10-07 22:43:18 +00:00
|
|
|
|
2018-09-20 11:12:14 +00:00
|
|
|
% Used for inline code snippets.
|
|
|
|
\def\code#1{\texttt{#1}}
|
|
|
|
|
2018-09-17 11:39:24 +00:00
|
|
|
% `call` has no special lexical status, so we just use \code{}.
|
|
|
|
\def\CALL{\code{call}}
|
|
|
|
|
2018-09-20 11:12:14 +00:00
|
|
|
% Define commands for `<<`, `>>`, `>>>` that avoid introducing guillemets.
|
|
|
|
\def\ltlt{<\mbox <}
|
|
|
|
\def\gtgt{>\mbox >}
|
|
|
|
\def\gtgtgt{>\mbox >\mbox >}
|
Fixed many whitespace issues in dartLangSpec.tex
In dartLangSpec.tex there used to be many white space anomalies, e.g.,
double spaces between words with no apparent justification
or multiple empty lines
or lines starting with indentation that wasn't justified by any
consistent rule that I could spot.
This CL fixes that.
It also adjusts the grammar rules to be formatted in a systematic way
which will be helpful for an update to use something else than
bnf.sty (that we can't distribute due to license problems).
In particular, when a right hand side is too long for one line it used
to flow into the next line just like text (so non-terminals would have
`-` inserted at locations where a natural language algorithm thought
the "word" could be split in two, and the indentation on the next line
was nonsensical). So now it uses `\gnewline{}` ("grammar newline") to
switch to a new line and indent somewhat. It also uses `\gcomma{}` to
produce a quoted comma (which otherwise looks funny, because the `,'
becomes more like `, ' because the comma has a sort of built-in space
after it).
The command `\cd{...}` is gone and `\code{...}` is used everywhere.
Every sentence is now terminated by a newline. This doesn't mean that
every line is <80 chars, but it is at least much more readable (in
an editor whose window is really big), and it's consistent with the
more radical changes that we have made whenever we have made bigger
changes to a paragraph.
Finally, all comments on interface injection and all comments on
spread and rest arguments have been deleted. These comments contained
considerations about said features, but they did not contribute to
the discussions that we have had about the same or similar topics
(in particular because the comments relied on assumptions that do
not hold any more).
So it's a big diff, but a huge portion of it is white space fixes,
and the rest is very systematic. So it should be bearable, and we
would surely need to do the same things over time, otherwise.
Change-Id: Ia5922c22cb496792d394e76ce8c7bca7df1b4cc8
Reviewed-on: https://dart-review.googlesource.com/25000
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-12-01 09:44:18 +00:00
|
|
|
|
|
|
|
% Used as line break in the right hand side of a grammar
|
|
|
|
% alternative, that is, when starting a "continuation line".
|
2018-11-02 12:11:41 +00:00
|
|
|
\newcommand{\gnewline}{\leavevmode\\}
|
Fixed many whitespace issues in dartLangSpec.tex
In dartLangSpec.tex there used to be many white space anomalies, e.g.,
double spaces between words with no apparent justification
or multiple empty lines
or lines starting with indentation that wasn't justified by any
consistent rule that I could spot.
This CL fixes that.
It also adjusts the grammar rules to be formatted in a systematic way
which will be helpful for an update to use something else than
bnf.sty (that we can't distribute due to license problems).
In particular, when a right hand side is too long for one line it used
to flow into the next line just like text (so non-terminals would have
`-` inserted at locations where a natural language algorithm thought
the "word" could be split in two, and the indentation on the next line
was nonsensical). So now it uses `\gnewline{}` ("grammar newline") to
switch to a new line and indent somewhat. It also uses `\gcomma{}` to
produce a quoted comma (which otherwise looks funny, because the `,'
becomes more like `, ' because the comma has a sort of built-in space
after it).
The command `\cd{...}` is gone and `\code{...}` is used everywhere.
Every sentence is now terminated by a newline. This doesn't mean that
every line is <80 chars, but it is at least much more readable (in
an editor whose window is really big), and it's consistent with the
more radical changes that we have made whenever we have made bigger
changes to a paragraph.
Finally, all comments on interface injection and all comments on
spread and rest arguments have been deleted. These comments contained
considerations about said features, but they did not contribute to
the discussions that we have had about the same or similar topics
(in particular because the comments relied on assumptions that do
not hold any more).
So it's a big diff, but a huge portion of it is white space fixes,
and the rest is very systematic. So it should be bearable, and we
would surely need to do the same things over time, otherwise.
Change-Id: Ia5922c22cb496792d394e76ce8c7bca7df1b4cc8
Reviewed-on: https://dart-review.googlesource.com/25000
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-12-01 09:44:18 +00:00
|
|
|
|
2018-07-10 12:41:24 +00:00
|
|
|
% Metavariables for argument lists.
|
|
|
|
\newcommand{\argumentList}[1]{\metavar{{#1}s}}
|
|
|
|
\newcommand{\parameterList}[1]{\metavar{{#1}s}}
|
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
% Colors used for for different kinds of text.
|
|
|
|
\definecolor{normativeColor}{rgb}{0,0,0}
|
2018-12-04 10:23:30 +00:00
|
|
|
\definecolor{commentaryColor}{rgb}{0.5,0.5,0.5}
|
|
|
|
\definecolor{rationaleColor}{rgb}{0.5,0.5,0.5}
|
2018-11-22 13:07:59 +00:00
|
|
|
|
|
|
|
% Environments for different kinds of text.
|
2018-12-17 15:01:46 +00:00
|
|
|
\newenvironment{Q}[1]{{\bf{}Upcoming: {#1}}}{}
|
2018-11-22 13:07:59 +00:00
|
|
|
\newenvironment{rationale}[1]{{\color{rationaleColor}\it{#1}}}{}
|
|
|
|
\newenvironment{commentary}[1]{{\color{commentaryColor}\sf{#1}}}{}
|
2013-10-07 22:43:18 +00:00
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
% Auxiliary functions.
|
2018-09-17 11:39:24 +00:00
|
|
|
\newcommand{\flatten}[1]{\ensuremath{\mbox{\it flatten}({#1})}}
|
2019-01-18 11:04:12 +00:00
|
|
|
\newcommand{\futureOrBase}[1]{\ensuremath{\mbox{\it futureOrBase}({#1})}}
|
2018-11-22 13:07:59 +00:00
|
|
|
\newcommand{\overrides}[1]{\ensuremath{\mbox{\it overrides}({#1})}}
|
|
|
|
\newcommand{\inherited}[1]{\ensuremath{\mbox{\it inherited}({#1})}}
|
2018-09-17 11:39:24 +00:00
|
|
|
|
|
|
|
% Used as a mini-section marker, indicating visibly that a range of
|
|
|
|
% text (usually just a couple of paragraphs) are concerned with one
|
|
|
|
% specific topic in a list of similar topics (like many forms of
|
|
|
|
% expressions of a similar nature).
|
|
|
|
\newcommand{\Case}[1]{\textbf{Case }$\langle\hspace{0.1em}${#1}$\hspace{0.1em}\rangle$\textbf{.}}
|
2018-12-17 15:01:46 +00:00
|
|
|
\newcommand{\EndCase}{\mbox{}\hfill$\scriptscriptstyle\Box$\xspace}
|
2018-09-17 11:39:24 +00:00
|
|
|
|
2019-02-26 12:22:56 +00:00
|
|
|
\newenvironment{dartCode}[1][!ht] {%
|
2018-09-20 11:12:14 +00:00
|
|
|
\def\@programcr{\@addfield\strut}%
|
|
|
|
\let\\=\@programcr%
|
|
|
|
\relax\@vobeyspaces\obeylines%
|
2018-11-22 13:07:59 +00:00
|
|
|
\ttfamily\color{commentaryColor}%
|
2019-02-26 12:22:56 +00:00
|
|
|
\vspace{1em}%
|
2018-11-22 13:07:59 +00:00
|
|
|
}{\normalcolor\vspace{1em}}
|
|
|
|
|
2019-02-26 12:22:56 +00:00
|
|
|
\newenvironment{normativeDartCode}[1][!ht] {%
|
2018-11-22 13:07:59 +00:00
|
|
|
\def\@programcr{\@addfield\strut}%
|
|
|
|
\let\\=\@programcr%
|
|
|
|
\relax\@vobeyspaces\obeylines%
|
|
|
|
\ttfamily\color{normativeColor}%
|
2019-02-26 12:22:56 +00:00
|
|
|
\vspace{1em}%
|
2018-11-22 13:07:59 +00:00
|
|
|
}{\normalcolor\vspace{1em}}
|
2013-10-07 22:43:18 +00:00
|
|
|
|
2018-09-20 11:12:14 +00:00
|
|
|
% Used for comments in a code context.
|
|
|
|
\def\comment#1{\textsf{#1}}
|
Introduced hash valued location markers in the spec
Introduced support for adding SHA1 hash valued location markers
at several levels in the language specification, added long explanatory
comment at the end, added a script 'addlatexhash.dart' to normalize
spacing, remove comments, etc., in the spec, such that the hash values
are more robust than they would be with a direct usage of the spec.
The script passes the "dvi2tty test", that is, when the location markers
are empty, the resulting *.dvi files created from dartLangSpec.tex and
from the version processed by the script give rise to the same text via
dvi2tty, i.e., the script does not destroy the spec.
R=gbracha@google.com, ricow@google.com
Review URL: https://codereview.chromium.org//646003002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41191 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-20 14:02:23 +00:00
|
|
|
|
2019-02-26 12:22:56 +00:00
|
|
|
% A commonly used metavariable for an identifier, operator.
|
2018-06-05 15:23:06 +00:00
|
|
|
\newcommand{\id}{\metavar{id}}
|
2019-02-26 12:22:56 +00:00
|
|
|
\newcommand{\op}{\metavar{op}}
|
2018-06-05 15:23:06 +00:00
|
|
|
|
2018-11-02 12:11:41 +00:00
|
|
|
% Used for defining occurrence of phrase, with customized index entry.
|
|
|
|
\newcommand{\IndexCustom}[2]{%
|
|
|
|
\leavevmode\marginpar{\ensuremath{\diamond}}\emph{#1}\index{#2}}
|
|
|
|
|
2019-01-21 12:56:31 +00:00
|
|
|
% Used when one concept should have >1 entry in the index. Does not add
|
|
|
|
% the diamond in the margin and shows no text where the command occurs.
|
|
|
|
% Intended to be used immediately after another \Index... command.
|
|
|
|
\newcommand{\IndexExtraEntry}[1]{\index{#1}}
|
|
|
|
|
2018-11-02 12:11:41 +00:00
|
|
|
% Used for a defining occurrence of a phrase, adding it to the index.
|
|
|
|
\newcommand{\Index}[1]{\IndexCustom{#1}{#1}}
|
|
|
|
|
|
|
|
% Same appearance, but not adding an entry to the index.
|
2019-02-26 12:22:56 +00:00
|
|
|
\newcommand{\NoIndex}[1]{%
|
2018-11-02 12:11:41 +00:00
|
|
|
\leavevmode\marginpar{\ensuremath{\diamond}}\emph{#1}}
|
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
% Used to specify comma separated lists of similar symbols.
|
|
|
|
\newcommand{\List}[3]{\ensuremath{{#1}_{#2},\,\ldots,\ {#1}_{#3}}}
|
|
|
|
|
|
|
|
% Used to specify comma separated lists of pairs of similar symbols,
|
|
|
|
% as needed, e.g., for declarations of formal parameters.
|
|
|
|
% Parameters: Name of first part of pair, name of second part,
|
|
|
|
% index at start, index at end.
|
|
|
|
\newcommand{\PairList}[4]{\ensuremath{%
|
|
|
|
{#1}_{#3}\ {#2}_{#3},\,\ldots,\ {#1}_{#4}\ {#2}_{#4}}}
|
|
|
|
|
|
|
|
% Used to specify comma separated lists of triples of similar symbols,
|
|
|
|
% as needed, e.g., for declarations of formal parameters with defaults.
|
|
|
|
% Parameters: Name of first part of triple, name of second part,
|
|
|
|
% name of third part, index at start, index at end.
|
|
|
|
\newcommand{\TripleList}[5]{\ensuremath{%
|
|
|
|
{#1}_{#4}\ {#2}_{#4}\ {#3}_{#4},\,\ldots,\ {#1}_{#5}\ {#2}_{#5}\ {#3}_{#5}}}
|
|
|
|
|
|
|
|
% Used to abbreviate \EXTENDS{} in function types.
|
|
|
|
\newcommand{\FunctionTypeExtends}{\ensuremath{\triangleleft}}
|
|
|
|
|
|
|
|
% Used to specify comma separated lists of pairs of symbols
|
|
|
|
% separated by \EXTENDS{}, as needed for type parameter declarations.
|
|
|
|
% Parameters: Type parameter name, bound name, number of type parameters.
|
|
|
|
\newcommand{\TypeParameters}[3]{\ensuremath{%
|
|
|
|
{#1}_1\,\EXTENDS\,{#2}_1,\,\ldots,\ %
|
|
|
|
{#1}_{#3}\,\EXTENDS\,{#2}_{#3}}}
|
|
|
|
|
2018-12-04 10:23:30 +00:00
|
|
|
% Used to specify comma separated lists of symbols followed by
|
|
|
|
% \EXTENDS{}, as needed for type parameter declarations where we do
|
|
|
|
% not intend to refer explicitly to the bounds.
|
|
|
|
% Parameters: Type parameter name, number of type parameters.
|
|
|
|
\newcommand{\TypeParametersNoBounds}[2]{\ensuremath{%
|
|
|
|
{#1}_1\,\EXTENDS\,\ldots,\ \ldots,\ {#1}_{#2}\,\EXTENDS\,\ldots}}
|
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
% For consistency, we may as well use this whenever possible.
|
|
|
|
\newcommand{\TypeParametersStd}{\TypeParameters{X}{B}{s}}
|
|
|
|
|
|
|
|
% Used to specify comma separated lists of pairs of symbols
|
|
|
|
% separated by \EXTENDS{}, as needed for type parameter declarations.
|
|
|
|
% Parameters: Type parameter name, bound name, number of type parameters.
|
|
|
|
\newcommand{\FTTypeParameters}[3]{\ensuremath{%
|
|
|
|
{#1}_1\FunctionTypeExtends{#2}_1,\,\ldots,\ %
|
|
|
|
{#1}_{#3}\FunctionTypeExtends{#2}_{#3}}}
|
|
|
|
|
2019-01-17 14:59:18 +00:00
|
|
|
% Used to specify simple non-generic function types: Same syntax as in source.
|
2018-11-22 13:07:59 +00:00
|
|
|
% Arguments: Return type, formal parameter declarations.
|
|
|
|
\newcommand{\FunctionTypeSimple}[2]{\code{\ensuremath{#1}\ \FUNCTION({#2})}}
|
|
|
|
|
2019-01-17 14:59:18 +00:00
|
|
|
% Used to specify simple generic function types: Same syntax as in source.
|
|
|
|
% Arguments: Return type, formal parameter declarations.
|
|
|
|
\newcommand{\FunctionTypeSimpleGeneric}[3]{\code{%
|
|
|
|
\ensuremath{#1}\ \FUNCTION<{#2}>({#3})}}
|
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
% Used to specify function types: Same syntax as in source.
|
|
|
|
% Arguments: Return type, spacer, type parameter name, bound name,
|
|
|
|
% number of type parameters, formal parameter declarations.
|
|
|
|
\newcommand{\FunctionType}[6]{\leavevmode\par\noindent\code{%
|
|
|
|
\ensuremath{#1}{#2}\FUNCTION<\FTTypeParameters{#3}{#4}{#5}>({#6})}}
|
|
|
|
|
2018-12-04 10:23:30 +00:00
|
|
|
% Same as \FunctionType except suitable for inline usage, hence omitting
|
|
|
|
% the spacer argument.
|
|
|
|
\newcommand{\RawFunctionType}[5]{\code{%
|
|
|
|
\ensuremath{#1}\ \FUNCTION<\FTTypeParameters{#2}{#3}{#4}>({#5})}}
|
|
|
|
|
2019-01-11 13:54:07 +00:00
|
|
|
% Used to specify function type parameter lists with positional optionals.
|
|
|
|
% Arguments: Parameter type, number of required parameters,
|
|
|
|
% number of optional parameters.
|
|
|
|
\newcommand{\FunctionTypePositionalArguments}[3]{%
|
|
|
|
\List{#1}{1}{#2},\ [\List{#1}{{#2}+1}{{#2}+{#3}}]}
|
|
|
|
|
|
|
|
\newcommand{\FunctionTypePositionalArgumentsStd}{%
|
|
|
|
\FunctionTypePositionalArguments{T}{n}{k}}
|
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
% Used to specify function types with positional optionals:
|
|
|
|
% Arguments: Return type, spacer, type parameter name, bound name,
|
|
|
|
% number of type parameters, parameter type, number of required parameters,
|
|
|
|
% number of optional parameters.
|
|
|
|
\newcommand{\FunctionTypePositional}[8]{%
|
2019-01-11 13:54:07 +00:00
|
|
|
\FunctionType{#1}{#2}{#3}{#4}{#5}{%
|
|
|
|
\FunctionTypePositionalArguments{#6}{#7}{#8}}}
|
2018-11-22 13:07:59 +00:00
|
|
|
|
2018-12-04 10:23:30 +00:00
|
|
|
% Same as \FunctionTypePositional except suitable for inline usage,
|
|
|
|
% hence omitting the spacer argument.
|
|
|
|
\newcommand{\RawFunctionTypePositional}[7]{%
|
2019-01-11 13:54:07 +00:00
|
|
|
\RawFunctionType{#1}{#2}{#3}{#4}{%
|
|
|
|
\FunctionTypePositionalArguments{#5}{#6}{#7}}}
|
|
|
|
|
|
|
|
% Used to specify function type parameter lists with named optionals.
|
|
|
|
% Arguments: Parameter type, number of required parameters,
|
|
|
|
% name of optional parameters, number of optional parameters.
|
|
|
|
\newcommand{\FunctionTypeNamedArguments}[4]{%
|
|
|
|
\List{#1}{1}{#2},\ \{\PairList{#1}{#3}{{#2}+1}{{#2}+{#4}}\}}
|
|
|
|
|
|
|
|
\newcommand{\FunctionTypeNamedArgumentsStd}{%
|
|
|
|
\FunctionTypeNamedArguments{T}{n}{x}{k}}
|
2018-12-04 10:23:30 +00:00
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
% Used to specify function types with named parameters:
|
|
|
|
% Arguments: Return type, spacer, type parameter name, bound name,
|
|
|
|
% number of type parameters, parameter type, number of required parameters,
|
|
|
|
% name of optional parameters, number of optional parameters.
|
|
|
|
\newcommand{\FunctionTypeNamed}[9]{%
|
2019-01-11 13:54:07 +00:00
|
|
|
\FunctionType{#1}{#2}{#3}{#4}{#5}{%
|
2019-01-18 11:04:12 +00:00
|
|
|
\FunctionTypeNamedArguments{#6}{#7}{#8}{#9}}}
|
2018-11-22 13:07:59 +00:00
|
|
|
|
2018-12-04 10:23:30 +00:00
|
|
|
% Same as \FunctionType except suitable for inline usage, hence omitting
|
|
|
|
% the spacer argument.
|
|
|
|
\newcommand{\RawFunctionTypeNamed}[8]{%
|
2019-01-11 13:54:07 +00:00
|
|
|
\RawFunctionType{#1}{#2}{#3}{#4}{%
|
2019-01-18 11:04:12 +00:00
|
|
|
\FunctionTypeNamedArguments{#5}{#6}{#7}{#8}}}
|
2018-12-04 10:23:30 +00:00
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
% Used to specify function types with no optional parameters:
|
|
|
|
% Arguments: Return type, spacer, type parameter name, bound name,
|
|
|
|
% number of type parameters, parameter type,
|
|
|
|
% number of parameters (all required).
|
|
|
|
\newcommand{\FunctionTypeAllRequired}[7]{%
|
|
|
|
\FunctionType{#1}{#2}{#3}{#4}{#5}{\List{#6}{1}{#7}}}
|
|
|
|
|
|
|
|
\newcommand{\FunctionTypePositionalStd}[1]{%
|
|
|
|
\FunctionTypePositional{#1}{ }{X}{B}{s}{T}{n}{k}}
|
|
|
|
|
2019-01-11 13:54:07 +00:00
|
|
|
\newcommand{\RawFunctionTypePositionalStd}[1]{%
|
|
|
|
\RawFunctionTypePositional{#1}{X}{B}{s}{T}{n}{k}}
|
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
\newcommand{\FunctionTypeNamedStd}[1]{%
|
|
|
|
\FunctionTypeNamed{#1}{ }{X}{B}{s}{T}{n}{x}{k}}
|
|
|
|
|
2019-01-11 13:54:07 +00:00
|
|
|
\newcommand{\RawFunctionTypeNamedStd}[1]{%
|
|
|
|
\RawFunctionTypeNamed{#1}{X}{B}{s}{T}{n}{x}{k}}
|
|
|
|
|
2018-11-22 13:07:59 +00:00
|
|
|
\newcommand{\FunctionTypeAllRequiredStd}[1]{%
|
|
|
|
\FunctionTypeAllRequired{#1}{ }{X}{B}{s}{T}{n}}
|
|
|
|
|
|
|
|
\newcommand{\FunctionTypePositionalStdCr}[1]{%
|
|
|
|
\FunctionTypePositional{#1}{\\}{X}{B}{s}{T}{n}{k}}
|
|
|
|
|
|
|
|
\newcommand{\FunctionTypeNamedStdCr}[1]{%
|
|
|
|
\FunctionTypeNamed{#1}{\\}{X}{B}{s}{T}{n}{x}{k}}
|
|
|
|
|
|
|
|
\newcommand{\FunctionTypeAllRequiredStdCr}[1]{%
|
|
|
|
\FunctionTypeAllRequired{#1}{\\}{X}{B}{s}{T}{n}}
|
|
|
|
|
|
|
|
\newcommand{\MoreSignatureSpecificSymbol}{\ensuremath{\preceq}}
|
|
|
|
\newcommand{\NotMoreSignatureSpecificSymbol}{\ensuremath{\not\preceq}}
|
|
|
|
\newcommand{\LessSignatureSpecificSymbol}{\ensuremath{\succeq}}
|
|
|
|
|
|
|
|
\newcommand{\MoreSignatureSpecific}[2]{%
|
|
|
|
\ensuremath{{#1}\MoreSignatureSpecificSymbol{#2}}}
|
|
|
|
\newcommand{\NotMoreSignatureSpecific}[2]{%
|
|
|
|
\ensuremath{{#1}\NotMoreSignatureSpecificSymbol{#2}}}
|
|
|
|
|
2018-12-04 10:23:30 +00:00
|
|
|
% Judgment expressing that a subtype relation exists.
|
|
|
|
\newcommand{\Subtype}[3]{\ensuremath{{#1}\vdash{#2}\,<:\,{#3}}}
|
|
|
|
\newcommand{\SubtypeStd}[2]{\Subtype{\Gamma}{#1}{#2}}
|
|
|
|
% Subtype judgment where the environment is omitted (NE: "no environment").
|
|
|
|
\newcommand{\SubtypeNE}[2]{\ensuremath{{#1}\,<:\,{#2}}}
|
|
|
|
|
|
|
|
% Judgment expressing that a supertype relation exists.
|
|
|
|
\newcommand{\Supertype}[3]{\ensuremath{{#1}\vdash{#2}\,:>\,{#3}}}
|
|
|
|
\newcommand{\SupertypeStd}[2]{\Supertype{\Gamma}{#1}{#2}}
|
|
|
|
|
|
|
|
% Judgment expressing that an assignability relation exists.
|
|
|
|
\newcommand{\AssignableRelationSymbol}{\ensuremath{\Longleftrightarrow}}
|
|
|
|
\newcommand{\Assignable}[3]{%
|
|
|
|
\ensuremath{{#1}\vdash{#2}\,\AssignableRelationSymbol\,{#3}}}
|
|
|
|
\newcommand{\AssignableStd}[2]{\Assignable{\Gamma}{#1}{#2}}
|
|
|
|
|
|
|
|
% Semantic function delivering the superinterfaces of a class.
|
|
|
|
\newcommand{\Superinterfaces}[1]{\ensuremath{\metavar{Superinterfaces}({#1})}}
|
|
|
|
\newcommand{\Superinterface}[2]{{#1}\in\Superinterfaces{#2}}
|
|
|
|
|
Introduced hash valued location markers in the spec
Introduced support for adding SHA1 hash valued location markers
at several levels in the language specification, added long explanatory
comment at the end, added a script 'addlatexhash.dart' to normalize
spacing, remove comments, etc., in the spec, such that the hash values
are more robust than they would be with a direct usage of the spec.
The script passes the "dvi2tty test", that is, when the location markers
are empty, the resulting *.dvi files created from dartLangSpec.tex and
from the version processed by the script give rise to the same text via
dvi2tty, i.e., the script does not destroy the spec.
R=gbracha@google.com, ricow@google.com
Review URL: https://codereview.chromium.org//646003002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41191 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-20 14:02:23 +00:00
|
|
|
% ----------------------------------------------------------------------
|
|
|
|
% Support for hash valued Location Markers
|
|
|
|
|
Working insertion of hash values; added a few labels in spec
Hash values are now computed for each "paragraph" starting with \LMHash
(which includes subsequent grammar, dartCode, itemize blocks, but stops
at \section-like commands). Now addlatexhash.dart expects three arguments
(first the source latex file, then the destination simplified and
hash-value-annotated latex source file, and finally a file name used to
create the list of hash values emitted). Adjusted testing accordingly.
Added a test for robustness of the hash value generation: It is checked
that lots of different "unimportant" changes make no difference for the
generated hash values (e.g., we can add/remove comments, change white
space, add \commentary{..} etc. without changing the hash values).
In order to ensure that all "structure" commands in the spec have a label,
I added an \LMLabel{..} a handful of places, following the style which is
used throughout the spec.
In dart.sty, the \renewcommand that made \LMHash{} produce a fixed
hash value has been removed such that the actual hash values are now
inserted into the generated spec PDF/DVI file. Tests have been adjusted
to handle this difference between the spec with and without hash values
when comparing the two.
R=gbracha@google.com, lrn@google.com, ricow@google.com
Committed: https://code.google.com/p/dart/source/detail?r=41658
Reverted: https://code.google.com/p/dart/source/detail?r=41662
Review URL: https://codereview.chromium.org//652993005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41687 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-12 08:41:55 +00:00
|
|
|
% very small font, to enable 40 char hash values in the margin
|
Introduced hash valued location markers in the spec
Introduced support for adding SHA1 hash valued location markers
at several levels in the language specification, added long explanatory
comment at the end, added a script 'addlatexhash.dart' to normalize
spacing, remove comments, etc., in the spec, such that the hash values
are more robust than they would be with a direct usage of the spec.
The script passes the "dvi2tty test", that is, when the location markers
are empty, the resulting *.dvi files created from dartLangSpec.tex and
from the version processed by the script give rise to the same text via
dvi2tty, i.e., the script does not destroy the spec.
R=gbracha@google.com, ricow@google.com
Review URL: https://codereview.chromium.org//646003002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41191 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-20 14:02:23 +00:00
|
|
|
\makeatletter
|
|
|
|
\ifcase \@ptsize \relax% 10pt
|
|
|
|
\newcommand{\miniscule}{\@setfontsize\miniscule{2}{3}}% \tiny: 5/6
|
|
|
|
\or% 11pt
|
|
|
|
\newcommand{\miniscule}{\@setfontsize\miniscule{3}{4}}% \tiny: 6/7
|
|
|
|
\or% 12pt
|
|
|
|
\newcommand{\miniscule}{\@setfontsize\miniscule{3}{4}}% \tiny: 6/7
|
|
|
|
\fi
|
|
|
|
\makeatother
|
|
|
|
|
|
|
|
% white: location markers should not create visual noise
|
|
|
|
\definecolor{LMdim}{gray}{1.0}
|
|
|
|
|
|
|
|
% insert location marker showing hash value of following paragraph
|
2018-11-02 12:11:41 +00:00
|
|
|
\newcommand{\LMHash}[1]{\leavevmode\marginpar{\quad%
|
2018-11-22 13:07:59 +00:00
|
|
|
\raisebox{0.5ex}{\miniscule{\color{LMdim}#1}}\vspace{-2\baselineskip}}%
|
|
|
|
\color{normativeColor}}
|
Introduced hash valued location markers in the spec
Introduced support for adding SHA1 hash valued location markers
at several levels in the language specification, added long explanatory
comment at the end, added a script 'addlatexhash.dart' to normalize
spacing, remove comments, etc., in the spec, such that the hash values
are more robust than they would be with a direct usage of the spec.
The script passes the "dvi2tty test", that is, when the location markers
are empty, the resulting *.dvi files created from dartLangSpec.tex and
from the version processed by the script give rise to the same text via
dvi2tty, i.e., the script does not destroy the spec.
R=gbracha@google.com, ricow@google.com
Review URL: https://codereview.chromium.org//646003002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41191 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-20 14:02:23 +00:00
|
|
|
|
|
|
|
% support convenient renewcommand
|
|
|
|
\let\OriginalLMHash\LMHash
|
|
|
|
|
|
|
|
% define a label, and show the associated logical location marker
|
|
|
|
\newcommand{\LMLabel}[1]{%
|
2018-11-02 12:11:41 +00:00
|
|
|
\vspace{-\baselineskip}\leavevmode\OriginalLMHash{\raisebox{10ex}{#1}}%
|
Introduced hash valued location markers in the spec
Introduced support for adding SHA1 hash valued location markers
at several levels in the language specification, added long explanatory
comment at the end, added a script 'addlatexhash.dart' to normalize
spacing, remove comments, etc., in the spec, such that the hash values
are more robust than they would be with a direct usage of the spec.
The script passes the "dvi2tty test", that is, when the location markers
are empty, the resulting *.dvi files created from dartLangSpec.tex and
from the version processed by the script give rise to the same text via
dvi2tty, i.e., the script does not destroy the spec.
R=gbracha@google.com, ricow@google.com
Review URL: https://codereview.chromium.org//646003002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41191 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-20 14:02:23 +00:00
|
|
|
\label{#1}}
|
|
|
|
% ----------------------------------------------------------------------
|