Skip to content

Commit e8be217

Browse files
authored
Merge pull request #202 from Philippus/clean-up-code
Replace LaTeX-style quotations and clean up
2 parents 3a7a8cc + f736174 commit e8be217

File tree

6 files changed

+8
-37
lines changed

6 files changed

+8
-37
lines changed

jvm/src/test/scala/scala/util/parsing/combinator/t9010.scala

-28
This file was deleted.

shared/src/main/scala/scala/util/parsing/combinator/JavaTokenParsers.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ trait JavaTokenParsers extends RegexParsers {
2929
* <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8">The Java Language Spec</a>.
3030
* Generally, this means a letter, followed by zero or more letters or numbers.
3131
*/
32-
def ident: Parser[String] = (
32+
def ident: Parser[String] =
3333
"" ~> // handle whitespace
3434
rep1(acceptIf(Character.isJavaIdentifierStart)("identifier expected but '" + _ + "' found"),
3535
elem("identifier part", Character.isJavaIdentifierPart(_: Char))) ^^ (_.mkString)
36-
)
3736

3837
/** An integer, without sign or with a negative sign. */
3938
def wholeNumber: Parser[String] =

shared/src/main/scala/scala/util/parsing/combinator/lexical/StdLexical.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ class StdLexical extends Lexical with StdTokens {
6363
)
6464

6565
protected def comment: Parser[Any] = (
66-
rep (chrExcept (EofCh, '*')) ~ '*' ~ '/' ^^ { case _ => ' ' }
67-
| rep (chrExcept (EofCh, '*')) ~ '*' ~ comment ^^ { case _ => ' ' }
66+
rep (chrExcept (EofCh, '*')) ~ '*' ~ '/' ^^ { _ => ' ' }
67+
| rep (chrExcept (EofCh, '*')) ~ '*' ~ comment ^^ { _ => ' ' }
6868
)
6969

7070
/** The set of reserved identifiers: these will be returned as `Keyword`s. */

shared/src/main/scala/scala/util/parsing/combinator/token/Tokens.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package token
2222
* @author Adriaan Moors
2323
*/
2424
trait Tokens {
25-
/** Objects of this type are produced by a lexical parser or ``scanner'', and consumed by a parser.
25+
/** Objects of this type are produced by a lexical parser or ``scanner``, and consumed by a parser.
2626
*
2727
* @see [[scala.util.parsing.combinator.syntactical.TokenParsers]]
2828
*/
@@ -43,5 +43,5 @@ trait Tokens {
4343
}
4444

4545
/** This token is produced by a scanner `Scanner` when scanning failed. */
46-
def errorToken(msg: String): Token = new ErrorToken(msg)
46+
def errorToken(msg: String): Token = ErrorToken(msg)
4747
}

shared/src/main/scala/scala/util/parsing/input/OffsetPosition.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package util.parsing.input
1616
import scala.collection.mutable.ArrayBuffer
1717

1818
/** `OffsetPosition` is a standard class for positions
19-
* represented as offsets into a source ``document''.
19+
* represented as offsets into a source ``document``.
2020
*
2121
* @param source The source document
2222
* @param offset The offset indicating the position
@@ -53,7 +53,7 @@ case class OffsetPosition(source: CharSequence, offset: Int) extends Position {
5353
var lo = 0
5454
var hi = index.length - 1
5555
while (lo + 1 < hi) {
56-
val mid = (hi + lo) / 2
56+
val mid = lo + ((hi - lo) / 2)
5757
if (offset < index(mid)) hi = mid
5858
else lo = mid
5959
}

shared/src/main/scala/scala/util/parsing/input/Position.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ trait Position {
3939
/** Returns a string representation of the `Position`, of the form `line.column`. */
4040
override def toString = ""+line+"."+column
4141

42-
/** Returns a more ``visual'' representation of this position.
42+
/** Returns a more ``visual`` representation of this position.
4343
* More precisely, the resulting string consists of two lines:
4444
* 1. the line in the document referred to by this position
4545
* 2. a caret indicating the column

0 commit comments

Comments
 (0)