8000 Migration message and version cleanup · dragos/scala-parser-combinators@354992f · GitHub
[go: up one dir, main page]

Skip to content

Commit 354992f

Browse files
socadriaanm
authored andcommitted
Migration message and version cleanup
The @migration annotation can now be used like @Deprecation. Old syntax is still supported, but deprecated. Improve wording and consistency of migration messages, migration warnings also print the version in which the change occurred now. Partially fixes SI-4990.
1 parent 4bf51fd commit 354992f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/library/scala/util/parsing/combinator/Parsers.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ trait Parsers {
8989
sealed abstract class ParseResult[+T] {
9090
/** Functional composition of ParseResults.
9191
*
92-
* @param `f` the function to be lifted over this result
92+
* @param f the function to be lifted over this result
9393
* @return `f` applied to the result of this `ParseResult`, packaged up as a new `ParseResult`
9494
*/
9595
def map[U](f: T => U): ParseResult[U]
9696

9797
/** Partial functional composition of ParseResults.
9898
*
99-
* @param `f` the partial function to be lifted over this result
99+
* @param f the partial function to be lifted over this result
100100
* @param error a function that takes the same argument as `f` and
101101
* produces an error message to explain why `f` wasn't applicable
102102
* (it is called when this is the case)
@@ -240,7 +240,7 @@ trait Parsers {
240240

241241
// no filter yet, dealing with zero is tricky!
242242

243-
@migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.")
243+
@migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0")
244244
def append[U >: T](p0: => Parser[U]): Parser[U] = { lazy val p = p0 // lazy argument
245245
Parser{ in => this(in) append p(in)}
246246
}
@@ -259,7 +259,7 @@ trait Parsers {
259259
* but easier to pattern match on) that contains the result of `p` and
260260
* that of `q`. The resulting parser fails if either `p` or `q` fails.
261261
*/
262-
@migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.")
262+
@migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0")
263263
def ~ [U](q: => Parser[U]): Parser[~[T, U]] = { lazy val p = q // lazy argument
264264
(for(a <- this; b <- p) yield new ~(a,b)).named("~")
265265
}
@@ -272,7 +272,7 @@ trait Parsers {
272272
* succeeds -- evaluated at most once, and only when necessary.
273273
* @return a `Parser` that -- on success -- returns the result of `q`.
274274
*/
275-
@migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.")
275+
@migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0")
276276
def ~> [U](q: => Parser[U]): Parser[U] = { lazy val p = q // lazy argument
277277
(for(a <- this; b <- p) yield b).named("~>")
278278
}
@@ -287,7 +287,7 @@ trait Parsers {
287287
* @param q a parser that will be executed after `p` (this parser) succeeds -- evaluated at most once, and only when necessary
288288
* @return a `Parser` that -- on success -- returns the result of `p`.
289289
*/
290-
@migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.")
290+
@migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0")
291291
def <~ [U](q: => Parser[U]): Parser[T] = { lazy val p = q // lazy argument
292292
(for(a <- this; b <- p) yield a).named("<~")
293293
}
@@ -302,7 +302,7 @@ trait Parsers {
302302
* `p ~! q` succeeds if `p` succeeds and `q` succeeds on the input left over by `p`.
303303
* In case of failure, no back-tracking is performed (in an earlier parser produced by the `|` combinator).
304304
*
305-
* @param q a parser that will be executed after `p` (this parser) succeeds
305+
* @param p a parser that will be executed after `p` (this parser) succeeds
306306
* @return a `Parser` that -- on success -- returns a `~` (like a Pair, but easier to pattern match on)
307307
* that contains the result of `p` and that of `q`.
308308
* The resulting parser fails if either `p` or `q` fails, this failure is fatal.
@@ -332,7 +332,7 @@ trait Parsers {
332332
* @param q0 a parser that accepts if p consumes less characters. -- evaluated at most once, and only when necessary
333333
* @return a `Parser` that returns the result of the parser consuming the most characters (out of `p` and `q`).
334334
*/
335-
@migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.")
335+
@migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0")
336336
def ||| [U >: T](q0: => Parser[U]): Parser[U] = new Parser[U] {
337337
lazy val q = q0 // lazy argument
338338
def apply(in: Input) = {
@@ -367,7 +367,7 @@ trait Parsers {
367367
* @param v The new result for the parser, evaluated at most once (if `p` succeeds), not evaluated at all if `p` fails.
368368
* @return a parser that has the same behaviour as the current parser, but whose successful result is `v`
369369
*/
370-
@migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.")
370+
@migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0")
371371
def ^^^ [U](v: => U): Parser[U] = new Parser[U] {
372372 C440
lazy val v0 = v // lazy argument
373373
def apply(in: Input) = Parser.this(in) map (x => v0)
@@ -706,7 +706,7 @@ trait Parsers {
706706
* @return A parser that returns a list of results produced by first applying `f` and then
707707
* repeatedly `p` to the input (it only succeeds if `f` matches).
708708
*/
709-
@migration(2, 9, "As of 2.9, the p0 call-by-name arguments is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.")
709+
@migration("The `p0` call-by-name arguments is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0")
710710
def rep1[T](first: => Parser[T], p0: => Parser[T]): Parser[List[T]] = Parser { in =>
711711
lazy val p = p0 // lazy argument
712712
val elems = new ListBuffer[T]
@@ -733,9 +733,9 @@ trait Parsers {
733733
* `repN(n, p)` uses `p` exactly `n` time to parse the input
734734
* (the result is a `List` of the `n` consecutive results of `p`).
735735
*
736-
* @param p a `Parser` that is to be applied successively to the input
737-
* @param n the exact number of times `p` must succeed
738-
* @return A parser that returns a list of results produced by repeatedly applying `p` to the input
736+
* @param p a `Parser` that is to be applied successively to the input
737+
* @param num the exact number of times `p` must succeed
738+
* @return A parser that returns a list of results produced by repeatedly applying `p` to the input
739739
* (and that only succeeds if `p` matches exactly `n` times).
740740
*/
741741
def repN[T](num: Int, p: => Parser[T]): Parser[List[T]] =

0 commit comments

Comments
 (0)
0