summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-03-10 16:30:45 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-03-10 16:31:47 -0700
commitdf2f3f7cd69bb042a29b4fcea3ab81d641f17906 (patch)
treeecbbdbe8603b9390022e7032fbe07570843020c0
parent839fd6e55b178b5c2a7aeaa7c9a542fd3637fe01 (diff)
downloadscala-df2f3f7cd69bb042a29b4fcea3ab81d641f17906.tar.gz
scala-df2f3f7cd69bb042a29b4fcea3ab81d641f17906.tar.bz2
scala-df2f3f7cd69bb042a29b4fcea3ab81d641f17906.zip
github markdown: headers
-rw-r--r--02-preface.md3
-rw-r--r--03-lexical-syntax.md18
-rw-r--r--04-identifiers-names-and-scopes.md3
-rw-r--r--05-types.md24
-rw-r--r--06-basic-declarations-and-definitions.md24
-rw-r--r--07-classes-and-objects.md18
-rw-r--r--08-expressions.md81
-rw-r--r--09-implicit-parameters-and-views.md18
-rw-r--r--10-pattern-matching.md18
-rw-r--r--11-top-level-definitions.md18
-rw-r--r--12-xml-expressions-and-patterns.md9
-rw-r--r--13-user-defined-annotations.md3
-rw-r--r--14-the-scala-standard-library.md18
-rw-r--r--15-scala-syntax-summary.md3
-rw-r--r--16-references.md3
-rw-r--r--README.md24
16 files changed, 95 insertions, 190 deletions
diff --git a/02-preface.md b/02-preface.md
index 11f14d2076..0e8b28958c 100644
--- a/02-preface.md
+++ b/02-preface.md
@@ -1,5 +1,4 @@
-Preface
--------
+## Preface
Scala is a Java-like programming language which unifies
object-oriented and functional programming. It is a pure
diff --git a/03-lexical-syntax.md b/03-lexical-syntax.md
index 6230bea8b3..5c6a0135c4 100644
--- a/03-lexical-syntax.md
+++ b/03-lexical-syntax.md
@@ -1,5 +1,4 @@
-Lexical Syntax
-==============
+# Lexical Syntax
Scala programs are written using the Unicode Basic Multilingual Plane
(_BMP_) character set; Unicode supplementary characters are not
@@ -34,8 +33,7 @@ classes (Unicode general category given in parentheses):
\pagebreak[1]
-Identifiers
------------
+## Identifiers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
op ::= opchar {opchar}
@@ -108,8 +106,7 @@ equivalents ‘=>’ and ‘<-’, are also reserved.
work-around: `` Thread.`yield`() ``{.scala}
-Newline Characters
-------------------
+## Newline Characters
~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
semi ::= ‘;’ | nl {nl}
@@ -293,8 +290,7 @@ A single new line token is accepted
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Literals
-----------
+## Literals
There are literals for integer numbers, floating point numbers,
characters, booleans, symbols, strings. The syntax of these literals is in
@@ -549,8 +545,7 @@ identical symbol literals are equivalent with respect to reference
equality.
-Whitespace and Comments
------------------------
+## Whitespace and Comments
Tokens may be separated by whitespace characters
and/or comments. Comments come in two forms:
@@ -565,8 +560,7 @@ but are required to be properly nested. Therefore, a comment like
comment.
-XML mode
---------
+## XML mode
In order to allow literal inclusion of XML fragments, lexical analysis
switches from Scala mode to XML mode when encountering an opening
diff --git a/04-identifiers-names-and-scopes.md b/04-identifiers-names-and-scopes.md
index d8e9a6b619..e5d8a70c59 100644
--- a/04-identifiers-names-and-scopes.md
+++ b/04-identifiers-names-and-scopes.md
@@ -1,5 +1,4 @@
-Identifiers, Names and Scopes
-=============================
+# Identifiers, Names and Scopes
Names in Scala identify types, values, methods, and classes which are
collectively called _entities_. Names are introduced by local
diff --git a/05-types.md b/05-types.md
index 9da7c5b075..624804df10 100644
--- a/05-types.md
+++ b/05-types.md
@@ -1,5 +1,4 @@
-Types
-=====
+# Types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Type ::= FunctionArgTypes ‘=>’ Type
@@ -59,8 +58,7 @@ Type constructors are another example, as one can write
the corresponding anonymous type function directly.
-Paths
------
+## Paths
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Path ::= StableId
@@ -92,8 +90,7 @@ A path is one of the following.
A _stable identifier_ is a path which ends in an identifier.
-Value Types
------------
+## Value Types
Every value in Scala has a type which is of one of the following
forms.
@@ -548,8 +545,7 @@ type.
`List[java.lang.Number]`.
-Non-Value Types
----------------
+## Non-Value Types
The types explained in the following do not denote sets of values, nor
do they appear explicitly in programs. They are introduced in this
@@ -641,8 +637,7 @@ the corresponding type parameter clause.
`newType` type constructor parameter in `flatMap`.
-Base Types and Member Definitions
----------------------------------
+## Base Types and Member Definitions
Types of class members depend on the way the members are referenced.
Central here are three notions, namely:
@@ -737,8 +732,7 @@ These notions are defined mutually recursively as follows.
share a to
-Relations between types
------------------------
+## Relations between types
We define two relations between types.
@@ -939,8 +933,7 @@ A _weak least upper bound_ is a least upper bound with respect to
weak conformance.
-Volatile Types
---------------
+## Volatile Types
Type volatility approximates the possibility that a type parameter or abstract
type instance
@@ -975,8 +968,7 @@ An existential type `$T$ forSome {$\,Q\,$}` is volatile if
$T$ is volatile.
-Type Erasure
-------------
+## Type Erasure
A type is called _generic_ if it contains type arguments or type variables.
_Type erasure_ is a mapping from (possibly generic) types to
diff --git a/06-basic-declarations-and-definitions.md b/06-basic-declarations-and-definitions.md
index 8f3c22ca0c..dcf41abce3 100644
--- a/06-basic-declarations-and-definitions.md
+++ b/06-basic-declarations-and-definitions.md
@@ -1,5 +1,4 @@
-Basic Declarations and Definitions
-==================================
+# Basic Declarations and Definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
@@ -36,8 +35,7 @@ between and including $s_i$ and $s_j$,
- If $s_k$ is a value definition, it must be lazy.
-Value Declarations and Definitions
-----------------------------------
+## Value Declarations and Definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Dcl ::= ‘val’ ValDcl
@@ -133,8 +131,7 @@ A value definition `val $p_1 , \ldots , p_n: T$ = $e$` is a shorthand for the
sequence of value definitions `val $p_1: T$ = $e$; ...; val $p_n: T$ = $e$`.
-Variable Declarations and Definitions
--------------------------------------
+## Variable Declarations and Definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
Dcl ::= ‘var’ VarDcl
@@ -236,8 +233,7 @@ A variable definition `var $x_1 , \ldots , x_n: T$ = $e$` is a shorthand for
the sequence of variable definitions
`var $x_1: T$ = $e$; ...; var $x_n: T$ = $e$`.
-Type Declarations and Type Aliases
-----------------------------------
+## Type Declarations and Type Aliases
<!-- TODO: Higher-kinded tdecls should have a separate section -->
@@ -334,8 +330,7 @@ objects of type $S$.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Type Parameters
----------------
+## Type Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
TypeParamClause ::= ‘[’ VariantTypeParam {‘,’ VariantTypeParam} ‘]’
@@ -398,8 +393,7 @@ The above scoping restrictions are generalized to the case of nested type parame
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Variance Annotations
---------------------
+## Variance Annotations
Variance annotations indicate how instances of parameterized types
vary with respect to [subtyping](#conformance). A
@@ -519,8 +513,7 @@ appear anywhere without restricting its legal variance annotations.
on which one can write only strings.
-Function Declarations and Definitions
--------------------------------------
+## Function Declarations and Definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Dcl ::= ‘def’ FunDcl
@@ -768,8 +761,7 @@ as $R$ conforms to $R'$.
in `C`, even though the method is recursive.
-Import Clauses
---------------
+## Import Clauses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
diff --git a/07-classes-and-objects.md b/07-classes-and-objects.md
index 959f482f0e..5e6cc3dfb5 100644
--- a/07-classes-and-objects.md
+++ b/07-classes-and-objects.md
@@ -1,5 +1,4 @@
-Classes and Objects
-===================
+# Classes and Objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
TmplDef ::= [`case'] `class' ClassDef
@@ -11,8 +10,7 @@ TmplDef ::= [`case'] `class' ClassDef
are both defined in terms of _templates_.
-Templates
----------
+## Templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
ClassTemplate ::= [EarlyDefs] ClassParents [TemplateBody]
@@ -485,8 +483,7 @@ before the superclass constructor of the template is called.
`"How are you, <null>"`.
-Modifiers
----------
+## Modifiers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Modifier ::= LocalModifier
@@ -676,8 +673,7 @@ the validity and meaning of a modifier are as follows.
constructor `private` (see \ref{ex:private-constr}).
-Class Definitions
------------------
+## Class Definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
TmplDef ::= `class' ClassDef
@@ -853,8 +849,7 @@ primary constructor of the class).
third one constructs a list with a given head and tail.
-Case Classes
-------------
+## Case Classes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
TmplDef ::= `case' `class' ClassDef
@@ -1090,8 +1085,7 @@ least proper supertype (which is statically known).
in `MyTable`.
-Object Definitions
-------------------
+## Object Definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
ObjectDef ::= id ClassTemplate
diff --git a/08-expressions.md b/08-expressions.md
index e63091c496..01b21ba91c 100644
--- a/08-expressions.md
+++ b/08-expressions.md
@@ -1,5 +1,4 @@
-Expressions
-===========
+# Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr ::= (Bindings | id | `_') `=>' Expr
@@ -47,8 +46,7 @@ Expressions
Expressions are composed of operators and operands. Expression forms are
discussed subsequently in decreasing order of precedence.
-Expression Typing
------------------
+## Expression Typing
The typing of expressions is often relative to some _expected type_
(which might be undefined).
@@ -72,8 +70,7 @@ $T$ forSome { type $t_1[\mathit{tps}_1] >: L_1 <: U_1$; $\ldots$; type $t_n[\mat
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Literals
---------
+## Literals
~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
SimpleExpr ::= Literal
@@ -83,8 +80,7 @@ Typing of literals is as described [here](#literals); their
evaluation is immediate.
-The _Null_ Value
---------------------
+## The _Null_ Value
The `null` value is of type `scala.Null`, and is thus
compatible with every reference type. It denotes a reference value
@@ -104,8 +100,7 @@ A reference to any other member of the ``null'' object causes a
`NullPointerException` to be thrown.
-Designators
------------
+## Designators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
SimpleExpr ::= Path
@@ -159,8 +154,7 @@ to a value different from `null`, otherwise a `scala.UnitializedError`
is thrown.
-This and Super
---------------
+## This and Super
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
SimpleExpr ::= [id `.'] `this'
@@ -240,8 +234,7 @@ it must be concrete.
depending on whether `B` is mixed in with class `Root` or `A`.
-Function Applications
----------------------
+## Function Applications
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
SimpleExpr ::= SimpleExpr1 ArgumentExprs
@@ -420,8 +413,7 @@ The final result of the transformation is a block of the form
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Method Values
--------------
+## Method Values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
SimpleExpr ::= SimpleExpr1 `_'
@@ -450,8 +442,7 @@ parameterlist `()`.
because otherwise the underscore would be considered part of the name.
-Type Applications
------------------
+## Type Applications
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
SimpleExpr ::= SimpleExpr TypeArgs
@@ -478,8 +469,7 @@ for a polymorphic functions from the types of the actual function arguments
and the expected result type.
-Tuples
-------
+## Tuples
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
SimpleExpr ::= `(' [Exprs] `)'
@@ -492,8 +482,7 @@ The empty tuple
`()` is the unique value of type `scala.Unit`.
-Instance Creation Expressions
------------------------------
+## Instance Creation Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
SimpleExpr ::= `new' (ClassTemplate | TemplateBody)
@@ -559,8 +548,7 @@ types: If `{$D$}` is a class body, then
where `anon\$X` is some freshly created name.
-Blocks
-------
+## Blocks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
BlockExpr ::= `{' Block `}'
@@ -623,8 +611,7 @@ $e$, which defines the result of the block.
`_1 forSome { type _1 <: B }` can be simplified to `B`.
-Prefix, Infix, and Postfix Operations
--------------------------------------
+## Prefix, Infix, and Postfix Operations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
PostfixExpr ::= InfixExpr [id [nl]]
@@ -759,8 +746,7 @@ The re-interpretation occurs if the following two conditions are fulfilled.
named `+`.
-Typed Expressions
------------------
+## Typed Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= PostfixExpr `:' CompoundType
@@ -779,8 +765,7 @@ the expression is the value of $e$ converted to type $T$.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Annotated Expressions
----------------------
+## Annotated Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= PostfixExpr `:' Annotation {Annotation}
@@ -791,8 +776,7 @@ attaches [annotations](#user-defined-annotations) $a_1 , \ldots , a_n$ to the
expression $e$.
-Assignments
------------
+## Assignments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= [SimpleExpr `.'] id `=' Expr
@@ -875,8 +859,7 @@ the invocation of an `update` function defined by $f$.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Conditional Expressions
------------------------
+## Conditional Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= `if' `(' Expr `)' {nl} Expr [[semi] `else' Expr]
@@ -902,8 +885,7 @@ A short form of the conditional expression eliminates the
else-part. The conditional expression `if ($e_1$) $e_2$` is
evaluated as if it was `if ($e_1$) $e_2$ else ()`.
-While Loop Expressions
-----------------------
+## While Loop Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= `while' `(' Expr ')' {nl} Expr
@@ -919,8 +901,7 @@ def whileLoop(cond: => Boolean)(body: => Unit): Unit =
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Do Loop Expressions
--------------------
+## Do Loop Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= `do' Expr [semi] `while' `(' Expr ')'
@@ -931,8 +912,7 @@ evaluated as if it was the expression `($e_1$ ; while ($e_2$) $e_1$)`.
A semicolon preceding the `while` symbol of a do loop expression is ignored.
-For Comprehensions and For Loops
---------------------------------
+## For Comprehensions and For Loops
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= `for' (`(' Enumerators `)' | `{' Enumerators `}')
@@ -1083,8 +1063,7 @@ comprehensions have been eliminated.
`scala.Array`.
-Return Expressions
-------------------
+## Return Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= `return' [Expr]
@@ -1122,8 +1101,7 @@ before the return expression is executed. In that case, the thrown
and will propagate up the call stack.
-Throw Expressions
------------------
+## Throw Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= `throw' Expr
@@ -1141,8 +1119,7 @@ executing the `throw` is aborted. The type of a throw expression
is `scala.Nothing`.
-Try Expressions
----------------
+## Try Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr1 ::= `try' `{' Block `}' [`catch' `{' CaseClauses `}']
@@ -1197,8 +1174,7 @@ is a shorthand
for `try { try { $b$ } catch $e_1$ } finally $e_2$`.
-Anonymous Functions
--------------------
+## Anonymous Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr ::= (Bindings | [`implicit'] id | `_') `=>' Expr
@@ -1309,8 +1285,7 @@ $e'$ results from $e$ by replacing each underscore section $u_i$ by $u_i'$.
--------------------------- ------------------------------------
-Constant Expressions
---------------------
+## Constant Expressions
Constant expressions are expressions that the Scala compiler can evaluate to a constant.
The definition of ``constant expression'' depends on the platform, but they
@@ -1327,8 +1302,7 @@ include at least the expressions of the following forms:
[constant value definition](#value-declarations-and-definitions).
-Statements
-----------
+## Statements
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
BlockStat ::= Import
@@ -1362,8 +1336,7 @@ Evaluation of a statement sequence entails evaluation of the
statements in the order they are written.
-Implicit Conversions
---------------------
+## Implicit Conversions
Implicit conversions can be applied to expressions whose type does not
match their expected type, to qualifiers in selections, and to unapplied methods. The
diff --git a/09-implicit-parameters-and-views.md b/09-implicit-parameters-and-views.md
index 202bf8dbd1..cdbafd9ca4 100644
--- a/09-implicit-parameters-and-views.md
+++ b/09-implicit-parameters-and-views.md
@@ -1,8 +1,6 @@
-Implicit Parameters and Views
-=============================
+# Implicit Parameters and Views
-The Implicit Modifier
----------------------
+## The Implicit Modifier
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
LocalModifier ::= ‘implicit’
@@ -37,8 +35,7 @@ type members, as well as for [top-level objects](#packagings).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Implicit Parameters
--------------------
+## Implicit Parameters
An implicit parameter list
`(implicit $p_1$,$\ldots$,$p_n$)`{.scala} of a method marks the parameters $p_1 , \ldots , p_n$ as
@@ -248,8 +245,7 @@ the type:
will issue an error signalling a divergent implicit expansion.
-Views
------
+## Views
Implicit parameters and methods can also define implicit conversions
called views. A _view_ from type $S$ to type $T$ is
@@ -319,8 +315,7 @@ or the call-by-name category).
method.
-Context Bounds and View Bounds
-------------------------------
+## Context Bounds and View Bounds
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
TypeParam ::= (id | ‘_’) [TypeParamClause] [‘>:’ Type] [‘<:’ Type]
@@ -372,8 +367,7 @@ additional implicit parameters.
def <= [B >: A <% Ordered[B]](that: B): Boolean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Manifests
----------
+## Manifests
Manifests are type descriptors that can be automatically generated by
diff --git a/10-pattern-matching.md b/10-pattern-matching.md
index 85639c8f7c..b3c1db3499 100644
--- a/10-pattern-matching.md
+++ b/10-pattern-matching.md
@@ -1,8 +1,6 @@
-Pattern Matching
-================
+# Pattern Matching
-Patterns
---------
+## Patterns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Pattern ::= Pattern1 { ‘|’ Pattern1 }
@@ -320,8 +318,7 @@ A pattern $p$ is _irrefutable_ for a type $T$, if one of the following applies:
of type $T$ has argument types $T_1 , \ldots , T_n$, and each $p_i$ is
irrefutable for $T_i$.
-Type Patterns
--------------
+## Type Patterns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
TypePat ::= Type
@@ -373,8 +370,7 @@ a lower case letter. However, the predefined primitive type aliases
`long`, `float`, and `double` are not
classified as type variable patterns.
-Type Parameter Inference in Patterns
-------------------------------------
+## Type Parameter Inference in Patterns
Type parameter inference is the process of finding bounds for the
bound type variables in a typed pattern or constructor
@@ -531,8 +527,7 @@ are inferred in the same way as for the typed pattern
function's declared result type, `Number`.
-Pattern Matching Expressions
-----------------------------
+## Pattern Matching Expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Expr ::= PostfixExpr `match' `{' CaseClauses `}'
@@ -649,8 +644,7 @@ possibility of a `MatchError` being raised at run-time.
conforms to its expected type, `T`.
-Pattern Matching Anonymous Functions
-------------------------------------
+## Pattern Matching Anonymous Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
BlockExpr ::= `{' CaseClauses `}'
diff --git a/11-top-level-definitions.md b/11-top-level-definitions.md
index fee07fb0fc..3229037fbf 100644
--- a/11-top-level-definitions.md
+++ b/11-top-level-definitions.md
@@ -1,8 +1,6 @@
-Top-Level Definitions
-=====================
+# Top-Level Definitions
-Compilation Units
------------------
+## Compilation Units
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
CompilationUnit ::= {‘package’ QualId semi} TopStatSeq
@@ -46,8 +44,7 @@ the package `java.lang`, the package `scala`, and the object
that order hide members of an earlier import.
-Packagings
-----------
+## Packagings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Packaging ::= ‘package’ QualId [nl] ‘{’ TopStatSeq ‘}’
@@ -89,8 +86,7 @@ therefore cannot be imported. However, members of the empty package
are visible to each other without qualification.
-Package Objects
----------------
+## Package Objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
PackageObject ::= ‘package’ ‘object’ ObjectDef
@@ -109,8 +105,7 @@ undefined. It is expected that this restriction will be lifted in a
future version of Scala.
-Package References
-------------------
+## Package References
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
QualId ::= id {‘.’ id}
@@ -145,8 +140,7 @@ outermost root package which contains all top-level packages.
contain a class `B`, a compiler-time error would result.
-Programs
---------
+## Programs
A _program_ is a top-level object that has a member method
_main_ of type `(Array[String])Unit`. Programs can be
diff --git a/12-xml-expressions-and-patterns.md b/12-xml-expressions-and-patterns.md
index 631d244575..b1f1a8f813 100644
--- a/12-xml-expressions-and-patterns.md
+++ b/12-xml-expressions-and-patterns.md
@@ -1,5 +1,4 @@
-XML Expressions and Patterns
-============================
+# XML Expressions and Patterns
__By Burak Emir__ \
@@ -7,8 +6,7 @@ This chapter describes the syntactic structure of XML expressions and patterns.
It follows as closely as possible the XML 1.0 specification \cite{w3c:xml},
changes being mandated by the possibility of embedding Scala code fragments.
-XML expressions
----------------
+## XML expressions
XML expressions are expressions generated by the following production, where the
opening bracket `<' of the first element must be in a position to start the lexical
@@ -100,8 +98,7 @@ XNameStart ::= ‘_’ | BaseChar | Ideographic
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-XML patterns
-------------
+## XML patterns
XML patterns are patterns generated by the following production, where
the opening bracket ‘<’ of the element patterns must be in a position
diff --git a/13-user-defined-annotations.md b/13-user-defined-annotations.md
index 44bbe654fe..4397ebdef2 100644
--- a/13-user-defined-annotations.md
+++ b/13-user-defined-annotations.md
@@ -1,5 +1,4 @@
-User-Defined Annotations
-========================
+# User-Defined Annotations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.grammar}
Annotation ::= ‘@’ SimpleType {ArgumentExprs}
diff --git a/14-the-scala-standard-library.md b/14-the-scala-standard-library.md
index 91b9f4c73e..2ba846e3f4 100644
--- a/14-the-scala-standard-library.md
+++ b/14-the-scala-standard-library.md
@@ -1,5 +1,4 @@
-The Scala Standard Library
-==========================
+# The Scala Standard Library
The Scala standard library consists of the package `scala` with a
number of classes and modules. Some of these classes are described in
@@ -8,8 +7,7 @@ the following.
![Class hierarchy of Scala](resources/classhierarchy.pdf)
-Root Classes
-------------
+## Root Classes
Figure~\ref{fig:class-hierarchy} illustrates Scala's class
hierarchy.
@@ -114,8 +112,7 @@ be translated to an application of a [conversion method](#numeric-value-types)
`x.to$T$`. For non-numeric values $x$ the operation will raise a
`ClassCastException`.
-Value Classes
--------------
+## Value Classes
Value classes are classes whose instances are not represented as
objects by the underlying host system. All value classes inherit from
@@ -335,8 +332,7 @@ unit value `()`, `false` otherwise. The
`hashCode` method returns a fixed, implementation-specific hash-code,
The `toString` method returns `"()"`.
-Standard Reference Classes
---------------------------
+## Standard Reference Classes
This section presents some standard Scala reference classes which are
treated in a special way in Scala compiler -- either Scala provides
@@ -561,8 +557,7 @@ object Array {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Class Node
-----------
+## Class Node
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
package scala.xml
@@ -636,8 +631,7 @@ trait Node {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The `Predef` Object
--------------------
+## The `Predef` Object
The `Predef` object defines standard functions and type aliases
for Scala programs. It is always implicitly imported, so that all its
diff --git a/15-scala-syntax-summary.md b/15-scala-syntax-summary.md
index 2b37ad07c8..2b880069b9 100644
--- a/15-scala-syntax-summary.md
+++ b/15-scala-syntax-summary.md
@@ -1,5 +1,4 @@
-Scala Syntax Summary
-====================
+# Scala Syntax Summary
<!-- TODO: introduce SeqPattern syntax -->
diff --git a/16-references.md b/16-references.md
index b84fabb623..82040075b6 100644
--- a/16-references.md
+++ b/16-references.md
@@ -1,7 +1,6 @@
-References
-==========
+# References
<!-- this is deliberately empty, and must be at the very end of the
document as pandoc will inject all citation information here.
diff --git a/README.md b/README.md
index b8e0622968..938d20ae4b 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,6 @@
-Scala Language Reference as Pandoc Markdown - Notes
-===================================================
+# Scala Language Reference as Pandoc Markdown - Notes
-Prerequisites
--------------
+## Prerequisites
In order to build the scala reference, you will require the following
software packages:
@@ -30,8 +28,7 @@ version of the specification.
here: <https://code.google.com/p/evristika/>
-General Advice for editors
---------------------------
+## General Advice for editors
- All files must be saved as UTF-8: ensure your editors are configured
appropriately.
@@ -46,8 +43,7 @@ General Advice for editors
you don't know how to type them directly.
-Useful tools
-------------
+## Useful tools
I have found the following tools to be useful for viewing and testing the
output of the various builds:
@@ -68,14 +64,12 @@ the [Package Control](http://wbond.net/sublime_packages/package_control)
Sublime Text plugin.
-Known issues and outstanding tasks
-----------------------------------
+## Known issues and outstanding tasks
Please see the issue tracker at <https://github.com/iainmcgin/scala-ref-markdown/issues>.
-Fixing known build errors / warnings
-------------------------------------
+## Fixing known build errors / warnings
### I am seeing `process\_defaultadd: n=-1 tag.data='NGENRE' level=0` every time I build the spec
@@ -90,8 +84,7 @@ run:
```
-Fixing rendering errors
-------------------------
+## Fixing rendering errors
MathJAX errors will appear within the rendered DOM as span elements with
class `mtext` and style attribute `color: red` applied. It is possible to
@@ -100,8 +93,7 @@ choice. In chrome, CTRL+F / CMD+F within the inspect element panel allows you
to do this.
-Conversion from LaTeX - Guidelines
-----------------------------------
+## Conversion from LaTeX - Guidelines
### Chapter conversion Checklist