summaryrefslogtreecommitdiff
path: root/spec/10-xml-expressions-and-patterns.md
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-09-19 09:59:56 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-09-19 09:59:56 +1000
commit379dbb0f6aa1d2d1233771a2dccec6c2dc584222 (patch)
tree1a2325793f329e71f91aedc094f3f0ebf73fe939 /spec/10-xml-expressions-and-patterns.md
parent79f59c5330122ee1ff1bac833bc77feca81d49af (diff)
parentd24ad908451e42925fe6be9995235bf2b4de1b39 (diff)
downloadscala-379dbb0f6aa1d2d1233771a2dccec6c2dc584222.tar.gz
scala-379dbb0f6aa1d2d1233771a2dccec6c2dc584222.tar.bz2
scala-379dbb0f6aa1d2d1233771a2dccec6c2dc584222.zip
Merge pull request #3984 from gourlaysama/wip/spec
General formatting improvements in the spec
Diffstat (limited to 'spec/10-xml-expressions-and-patterns.md')
-rw-r--r--spec/10-xml-expressions-and-patterns.md55
1 files changed, 27 insertions, 28 deletions
diff --git a/spec/10-xml-expressions-and-patterns.md b/spec/10-xml-expressions-and-patterns.md
index d8c45ecf85..069f499ce9 100644
--- a/spec/10-xml-expressions-and-patterns.md
+++ b/spec/10-xml-expressions-and-patterns.md
@@ -14,7 +14,7 @@ changes being mandated by the possibility of embedding Scala code fragments.
## XML expressions
-XML expressions are expressions generated by the following production, where the
+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
[XML mode](01-lexical-syntax.html#xml-mode).
@@ -29,18 +29,18 @@ related to entity resolution.
The following productions describe Scala's extensible markup language,
designed as close as possible to the W3C extensible markup language
-standard. Only the productions for attribute values and character data are changed.
+standard. Only the productions for attribute values and character data are changed.
Scala does not support declarations, CDATA sections or processing instructions.
Entity references are not resolved at runtime.
```ebnf
Element ::= EmptyElemTag
- | STag Content ETag
+ | STag Content ETag
-EmptyElemTag ::= ‘<’ Name {S Attribute} [S] ‘/>’
+EmptyElemTag ::= ‘<’ Name {S Attribute} [S] ‘/>’
-STag ::= ‘<’ Name {S Attribute} [S] ‘>’
-ETag ::= ‘</’ Name [S] ‘>’
+STag ::= ‘<’ Name {S Attribute} [S] ‘>’
+ETag ::= ‘</’ Name [S] ‘>’
Content ::= [CharData] {Content1 [CharData]}
Content1 ::= XmlContent
| Reference
@@ -52,23 +52,23 @@ XmlContent ::= Element
```
If an XML expression is a single element, its value is a runtime
-representation of an XML node (an instance of a subclass of
+representation of an XML node (an instance of a subclass of
`scala.xml.Node`). If the XML expression consists of more
than one element, then its value is a runtime representation of a
-sequence of XML nodes (an instance of a subclass of
+sequence of XML nodes (an instance of a subclass of
`scala.Seq[scala.xml.Node]`).
-If an XML expression is an entity reference, CDATA section, processing
-instructions or a comments, it is represented by an instance of the
+If an XML expression is an entity reference, CDATA section, processing
+instructions or a comments, it is represented by an instance of the
corresponding Scala runtime class.
-By default, beginning and trailing whitespace in element content is removed,
+By default, beginning and trailing whitespace in element content is removed,
and consecutive occurrences of whitespace are replaced by a single space
character `\u0020`. This behavior can be changed to preserve all whitespace
with a compiler option.
```ebnf
-Attribute ::= Name Eq AttValue
+Attribute ::= Name Eq AttValue
AttValue ::= ‘"’ {CharQ | CharRef} ‘"’
| ‘'’ {CharA | CharRef} ‘'’
@@ -76,13 +76,13 @@ AttValue ::= ‘"’ {CharQ | CharRef} ‘"’
ScalaExpr ::= Block
-CharData ::= { CharNoRef } $\mbox{\rm\em without}$ {CharNoRef}`{'CharB {CharNoRef}
- $\mbox{\rm\em and without}$ {CharNoRef}`]]>'{CharNoRef}
+CharData ::= { CharNoRef } $\textit{ without}$ {CharNoRef}`{'CharB {CharNoRef}
+ $\textit{ and without}$ {CharNoRef}`]]>'{CharNoRef}
```
<!-- {% raw %} stupid liquid borks on the double brace below; brace yourself, liquid! -->
XML expressions may contain Scala expressions as attribute values or
-within nodes. In the latter case, these are embedded using a single opening
+within nodes. In the latter case, these are embedded using a single opening
brace `{` and ended by a closing brace `}`. To express a single opening braces
within XML text as generated by CharData, it must be doubled.
Thus, `{{` represents the XML text `{` and does not introduce an embedded Scala expression.
@@ -90,17 +90,17 @@ Thus, `{{` represents the XML text `{` and does not introduce an embedded Scala
```ebnf
BaseChar, Char, Comment, CombiningChar, Ideographic, NameChar, S, Reference
- ::= $\mbox{\rm\em “as in W3C XML”}$
+ ::= $\textit{“as in W3C XML”}$
-Char1 ::= Char $\mbox{\rm\em without}$ ‘<’ | ‘&’
-CharQ ::= Char1 $\mbox{\rm\em without}$ ‘"’
-CharA ::= Char1 $\mbox{\rm\em without}$ ‘'’
-CharB ::= Char1 $\mbox{\rm\em without}$ ‘{’
+Char1 ::= Char $\textit{ without}$ ‘<’ | ‘&’
+CharQ ::= Char1 $\textit{ without}$ ‘"’
+CharA ::= Char1 $\textit{ without}$ ‘'’
+CharB ::= Char1 $\textit{ without}$ ‘{’
Name ::= XNameStart {NameChar}
-XNameStart ::= ‘_’ | BaseChar | Ideographic
- $\mbox{\rm\em (as in W3C XML, but without }$ ‘:’
+XNameStart ::= ‘_’ | BaseChar | Ideographic
+ $\textit{ (as in W3C XML, but without }$ ‘:’$)$
```
## XML patterns
@@ -110,7 +110,7 @@ the opening bracket `<` of the element patterns must be in a position
to start the lexical [XML mode](01-lexical-syntax.html#xml-mode).
```ebnf
-XmlPattern ::= ElementPattern
+XmlPattern ::= ElementPattern
```
Well-formedness constraints of the XML specification apply.
@@ -123,18 +123,18 @@ XML patterns may contain [Scala patterns](08-pattern-matching.html#pattern-match
Whitespace is treated the same way as in XML expressions.
-By default, beginning and trailing whitespace in element content is removed,
+By default, beginning and trailing whitespace in element content is removed,
and consecutive occurrences of whitespace are replaced by a single space
character `\u0020`. This behavior can be changed to preserve all whitespace
with a compiler option.
```ebnf
ElemPattern ::= EmptyElemTagP
- | STagP ContentP ETagP
+ | STagP ContentP ETagP
EmptyElemTagP ::= ‘<’ Name [S] ‘/>’
-STagP ::= ‘<’ Name [S] ‘>’
-ETagP ::= ‘</’ Name [S] ‘>’
+STagP ::= ‘<’ Name [S] ‘>’
+ETagP ::= ‘</’ Name [S] ‘>’
ContentP ::= [CharData] {(ElemPattern|ScalaPatterns) [CharData]}
ContentP1 ::= ElemPattern
| Reference
@@ -144,4 +144,3 @@ ContentP1 ::= ElemPattern
| ScalaPatterns
ScalaPatterns ::= ‘{’ Patterns ‘}’
```
-