Skip to content

Commit 57bf3a2

Browse files
retronymadriaanm
authored andcommitted
Banish needless semicolons.
1 parent 7c62d79 commit 57bf3a2

File tree

12 files changed

+82
-82
lines changed

12 files changed

+82
-82
lines changed

src/library/scala/xml/Utility.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,14 @@ object Utility extends AnyRef with parsing.TokenTests {
311311
while (i < value.length) {
312312
value.charAt(i) match {
313313
case '<' =>
314-
return "< not allowed in attribute value";
314+
return "< not allowed in attribute value"
315315
case '&' =>
316316
val n = getName(value, i+1)
317317
if (n eq null)
318-
return "malformed entity reference in attribute value ["+value+"]";
318+
return "malformed entity reference in attribute value ["+value+"]"
319319
i = i + n.length + 1
320320
if (i >= value.length || value.charAt(i) != ';')
321-
return "malformed entity reference in attribute value ["+value+"]";
321+
return "malformed entity reference in attribute value ["+value+"]"
322322
case _ =>
323323
}
324324
i = i + 1

src/library/scala/xml/dtd/ContentModelParser.scala

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ object ContentModelParser extends Scanner { // a bit too permissive concerning #
2121
if (token != tok) {
2222
if ((tok == STAR) && (token == END)) // common mistake
2323
scala.sys.error("in DTDs, \n"+
24-
"mixed content models must be like (#PCDATA|Name|Name|...)*");
24+
"mixed content models must be like (#PCDATA|Name|Name|...)*")
2525
else
2626
scala.sys.error("expected "+token2string(tok)+
27-
", got unexpected token:"+token2string(token));
27+
", got unexpected token:"+token2string(token))
2828
}
2929
nextToken
3030
}
@@ -44,43 +44,43 @@ object ContentModelParser extends Scanner { // a bit too permissive concerning #
4444
case NAME => value match {
4545
case "ANY" => ANY
4646
case "EMPTY" => EMPTY
47-
case _ => scala.sys.error("expected ANY, EMPTY or '(' instead of " + value );
47+
case _ => scala.sys.error("expected ANY, EMPTY or '(' instead of " + value )
4848
}
4949
case LPAREN =>
5050

51-
nextToken;
52-
sOpt;
51+
nextToken
52+
sOpt
5353
if (token != TOKEN_PCDATA)
54-
ELEMENTS(regexp);
54+
ELEMENTS(regexp)
5555
else {
56-
nextToken;
56+
nextToken
5757
token match {
5858
case RPAREN =>
5959
PCDATA
6060
case CHOICE =>
61-
val res = MIXED(choiceRest(Eps));
62-
sOpt;
63-
accept( RPAREN );
64-
accept( STAR );
61+
val res = MIXED(choiceRest(Eps))
62+
sOpt
63+
accept( RPAREN )
64+
accept( STAR )
6565
res
6666
case _ =>
67-
scala.sys.error("unexpected token:" + token2string(token) );
67+
scala.sys.error("unexpected token:" + token2string(token) )
6868
}
6969
}
7070

7171
case _ =>
72-
scala.sys.error("unexpected token:" + token2string(token) );
73-
}
72+
scala.sys.error("unexpected token:" + token2string(token) )
73+
}
7474
// sopt ::= S?
75-
def sOpt() = if( token == S ) nextToken;
75+
def sOpt() = if( token == S ) nextToken
7676

7777
// (' S? mixed ::= '#PCDATA' S? ')'
7878
// | '#PCDATA' (S? '|' S? atom)* S? ')*'
7979

8080
// '(' S? regexp ::= cp S? [seqRest|choiceRest] ')' [ '+' | '*' | '?' ]
8181
def regexp: RegExp = {
82-
val p = particle;
83-
sOpt;
82+
val p = particle
83+
sOpt
8484
maybeSuffix(token match {
8585
case RPAREN => nextToken; p
8686
case CHOICE => val q = choiceRest( p );accept( RPAREN ); q
@@ -90,39 +90,39 @@ object ContentModelParser extends Scanner { // a bit too permissive concerning #
9090

9191
// seqRest ::= (',' S? cp S?)+
9292
def seqRest(p: RegExp) = {
93-
var k = List(p);
93+
var k = List(p)
9494
while( token == COMMA ) {
95-
nextToken;
96-
sOpt;
97-
k = particle::k;
98-
sOpt;
95+
nextToken
96+
sOpt
97+
k = particle::k
98+
sOpt
9999
}
100100
Sequ( k.reverse:_* )
101101
}
102102

103103
// choiceRest ::= ('|' S? cp S?)+
104104
def choiceRest( p:RegExp ) = {
105-
var k = List( p );
105+
var k = List( p )
106106
while( token == CHOICE ) {
107-
nextToken;
108-
sOpt;
109-
k = particle::k;
110-
sOpt;
107+
nextToken
108+
sOpt
109+
k = particle::k
110+
sOpt
111111
}
112112
Alt( k.reverse:_* )
113113
}
114114

115115
// particle ::= '(' S? regexp
116116
// | name [ '+' | '*' | '?' ]
117117
def particle = token match {
118-
case LPAREN => nextToken; sOpt; regexp;
118+
case LPAREN => nextToken; sOpt; regexp
119119
case NAME => val a = Letter(ElemName(value)); nextToken; maybeSuffix(a)
120-
case _ => scala.sys.error("expected '(' or Name, got:"+token2string(token));
120+
case _ => scala.sys.error("expected '(' or Name, got:"+token2string(token))
121121
}
122122

123123
// atom ::= name
124124
def atom = token match {
125125
case NAME => val a = Letter(ElemName(value)); nextToken; a
126-
case _ => scala.sys.error("expected Name, got:"+token2string(token));
126+
case _ => scala.sys.error("expected Name, got:"+token2string(token))
127127
}
128128
}

src/library/scala/xml/dtd/Decl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ case class ExtDef(extID:ExternalID) extends EntityDef {
123123
/** a parsed entity reference */
124124
case class PEReference(ent:String) extends MarkupDecl {
125125
if( !Utility.isName( ent ))
126-
throw new IllegalArgumentException("ent must be an XML Name");
126+
throw new IllegalArgumentException("ent must be an XML Name")
127127

128128
override def buildString(sb: StringBuilder): StringBuilder =
129129
sb append '%' append ent append ';'

src/library/scala/xml/dtd/Scanner.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ class Scanner extends Tokens with parsing.TokenTests {
3939

4040
// todo: see XML specification... probably isLetter,isDigit is fine
4141
final def isIdentChar = ( ('a' <= c && c <= 'z')
42-
|| ('A' <= c && c <= 'Z'));
42+
|| ('A' <= c && c <= 'Z'))
4343

4444
final def next() = if (it.hasNext) c = it.next else c = ENDCH
4545

4646
final def acc(d: Char) {
47-
if (c == d) next else scala.sys.error("expected '"+d+"' found '"+c+"' !");
47+
if (c == d) next else scala.sys.error("expected '"+d+"' found '"+c+"' !")
4848
}
4949

5050
final def accS(ds: Seq[Char]) { ds foreach acc }
@@ -70,7 +70,7 @@ class Scanner extends Tokens with parsing.TokenTests {
7070

7171
final def name = {
7272
val sb = new StringBuilder()
73-
do { sb.append(c); next } while (isNameChar(c));
73+
do { sb.append(c); next } while (isNameChar(c))
7474
value = sb.toString()
7575
NAME
7676
}

src/library/scala/xml/dtd/ValidationException.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object MakeValidationException {
3333

3434
def fromMissingAttribute(allKeys: Set[String]) = {
3535
val sb = new StringBuilder("missing value for REQUIRED attribute")
36-
if (allKeys.size > 1) sb.append('s');
36+
if (allKeys.size > 1) sb.append('s')
3737
allKeys foreach (k => sb append "'%s'".format(k))
3838
new ValidationException(sb.toString())
3939
}

src/library/scala/xml/factory/Binder.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ abstract class Binder(val preserveWS: Boolean) extends ValidatingMarkupHandler {
4848
val old = result
4949
result = new NodeBuffer()
5050
for (m <- x.child) traverse(m)
51-
result = old &+ elem(0, x.prefix, x.label, x.attributes, x.scope, x.minimizeEmpty, NodeSeq.fromSeq(result)).toList;
51+
result = old &+ elem(0, x.prefix, x.label, x.attributes, x.scope, x.minimizeEmpty, NodeSeq.fromSeq(result)).toList
5252
elemEnd(0, x.prefix, x.label)
5353
}
5454

src/library/scala/xml/factory/LoggedNodeFactory.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ trait LoggedNodeFactory[A <: Node] extends NodeFactory[A] with scala.util.loggin
4646
override def makeNode(pre: String, label: String, attrSeq: MetaData,
4747
scope: NamespaceBinding, children: Seq[Node]): A = {
4848
if (logNode)
49-
log("[makeNode for "+label+"]");
49+
log("[makeNode for "+label+"]")
5050

5151
val hash = Utility.hashCode(pre, label, attrSeq.##, scope.##, children)
5252

@@ -59,26 +59,26 @@ trait LoggedNodeFactory[A <: Node] extends NodeFactory[A] with scala.util.loggin
5959
}
6060
*/
6161
if (!cache.get( hash ).isEmpty && (logCompressLevel >= CACHE))
62-
log("[cache hit !]");
62+
log("[cache hit !]")
6363

6464
super.makeNode(pre, label, attrSeq, scope, children)
6565
}
6666

6767
override def makeText(s: String) = {
6868
if (logText)
69-
log("[makeText:\""+s+"\"]");
69+
log("[makeText:\""+s+"\"]")
7070
super.makeText(s)
7171
}
7272

7373
override def makeComment(s: String): Seq[Comment] = {
7474
if (logComment)
75-
log("[makeComment:\""+s+"\"]");
75+
log("[makeComment:\""+s+"\"]")
7676
super.makeComment(s)
7777
}
7878

7979
override def makeProcInstr(t: String, s: String): Seq[ProcInstr] = {
8080
if (logProcInstr)
81-
log("[makeProcInstr:\""+t+" "+ s+"\"]");
81+
log("[makeProcInstr:\""+t+" "+ s+"\"]")
8282
super.makeProcInstr(t, s)
8383
}
8484

src/library/scala/xml/include/sax/XIncludeFilter.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ class XIncludeFilter extends XMLFilterImpl {
147147

148148
if (parse equals "text") {
149149
val encoding = atts getValue "encoding"
150-
includeTextDocument(href, encoding);
150+
includeTextDocument(href, encoding)
151151
}
152152
else if (parse equals "xml") {
153-
includeXMLDocument(href);
153+
includeXMLDocument(href)
154154
}
155155
// Need to check this also in DOM and JDOM????
156156
else {
@@ -184,7 +184,7 @@ class XIncludeFilter extends XMLFilterImpl {
184184
}
185185
}
186186

187-
private var depth = 0;
187+
private var depth = 0
188188

189189
override def startDocument() {
190190
level = 0
@@ -240,7 +240,7 @@ class XIncludeFilter extends XMLFilterImpl {
240240
}
241241
locationString = (" in document included from " + publicID
242242
+ " at " + systemID
243-
+ " at line " + line + ", column " + column);
243+
+ " at line " + line + ", column " + column)
244244

245245
locationString
246246
}
@@ -258,7 +258,7 @@ class XIncludeFilter extends XMLFilterImpl {
258258
*/
259259
private def includeTextDocument(url: String, encoding1: String) {
260260
var encoding = encoding1
261-
if (encoding == null || encoding.trim().equals("")) encoding = "UTF-8";
261+
if (encoding == null || encoding.trim().equals("")) encoding = "UTF-8"
262262
var source: URL = null
263263
try {
264264
val base = bases.peek().asInstanceOf[URL]
@@ -284,13 +284,13 @@ class XIncludeFilter extends XMLFilterImpl {
284284
// MIME types are case-insensitive
285285
// Java may be picking this up from file URL
286286
if (contentType != null) {
287-
contentType = contentType.toLowerCase();
287+
contentType = contentType.toLowerCase()
288288
if (contentType.equals("text/xml")
289289
|| contentType.equals("application/xml")
290290
|| (contentType.startsWith("text/") && contentType.endsWith("+xml") )
291291
|| (contentType.startsWith("application/") && contentType.endsWith("+xml"))) {
292-
encoding = EncodingHeuristics.readEncodingFromStream(in);
293-
}
292+
encoding = EncodingHeuristics.readEncodingFromStream(in)
293+
}
294294
}
295295
}
296296
val reader = new InputStreamReader(in, encoding)

src/library/scala/xml/include/sax/XIncluder.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit
2828
def startDocument() {
2929
try {
3030
out.write("<?xml version='1.0' encoding='"
31-
+ encoding + "'?>\r\n");
31+
+ encoding + "'?>\r\n")
3232
}
3333
catch {
3434
case e:IOException =>
@@ -52,16 +52,16 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit
5252

5353
def startElement(namespaceURI: String, localName: String, qualifiedName: String, atts: Attributes) = {
5454
try {
55-
out.write("<" + qualifiedName);
55+
out.write("<" + qualifiedName)
5656
var i = 0; while (i < atts.getLength()) {
57-
out.write(" ");
58-
out.write(atts.getQName(i));
59-
out.write("='");
60-
val value = atts.getValue(i);
57+
out.write(" ")
58+
out.write(atts.getQName(i))
59+
out.write("='")
60+
val value = atts.getValue(i)
6161
// @todo Need to use character references if the encoding
6262
// can't support the character
6363
out.write(scala.xml.Utility.escape(value))
64-
out.write("'");
64+
out.write("'")
6565
i += 1
6666
}
6767
out.write(">")
@@ -87,20 +87,20 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit
8787
def characters(ch: Array[Char], start: Int, length: Int) {
8888
try {
8989
var i = 0; while (i < length) {
90-
val c = ch(start+i);
91-
if (c == '&') out.write("&amp;");
92-
else if (c == '<') out.write("&lt;");
90+
val c = ch(start+i)
91+
if (c == '&') out.write("&amp;")
92+
else if (c == '<') out.write("&lt;")
9393
// This next fix is normally not necessary.
9494
// However, it is required if text contains ]]>
9595
// (The end CDATA section delimiter)
96-
else if (c == '>') out.write("&gt;");
97-
else out.write(c);
96+
else if (c == '>') out.write("&gt;")
97+
else out.write(c)
9898
i += 1
9999
}
100100
}
101101
catch {
102102
case e: IOException =>
103-
throw new SAXException("Write failed", e);
103+
throw new SAXException("Write failed", e)
104104
}
105105
}
106106

@@ -138,8 +138,8 @@ class XIncluder(outs: OutputStream, encoding: String) extends ContentHandler wit
138138
// if this is the source document, output a DOCTYPE declaration
139139
if (entities.isEmpty) {
140140
var id = ""
141-
if (publicID != null) id = " PUBLIC \"" + publicID + "\" \"" + systemID + '"';
142-
else if (systemID != null) id = " SYSTEM \"" + systemID + '"';
141+
if (publicID != null) id = " PUBLIC \"" + publicID + "\" \"" + systemID + '"'
142+
else if (systemID != null) id = " SYSTEM \"" + systemID + '"'
143143
try {
144144
out.write("<!DOCTYPE " + name + id + ">\r\n")
145145
}

0 commit comments

Comments
 (0)