@@ -63,7 +63,7 @@ trait PackratParsers extends Parsers {
6363 /*
6464 * caching of intermediate parse results and information about recursion
6565 */
66- private [PackratParsers ] val cache = mutable.HashMap .empty[(Parser [_ ], Position ), MemoEntry [_ ]]
66+ private [PackratParsers ] val cache = mutable.HashMap .empty[(Parser [? ], Position ), MemoEntry [? ]]
6767
6868 private [PackratParsers ] def getFromCache [T2 ](p : Parser [T2 ]): Option [MemoEntry [T2 ]] = {
6969 cache.get((p, pos)).asInstanceOf [Option [MemoEntry [T2 ]]]
@@ -105,28 +105,28 @@ trait PackratParsers extends Parsers {
105105 val q = super .phrase(p)
106106 new PackratParser [T ] {
107107 def apply (in : Input ) = in match {
108- case in : PackratReader [_ ] => q(in)
108+ case in : PackratReader [? ] => q(in)
109109 case in => q(new PackratReader (in))
110110 }
111111 }
112112 }
113113
114- private def getPosFromResult (r : ParseResult [_ ]): Position = r.next.pos
114+ private def getPosFromResult (r : ParseResult [? ]): Position = r.next.pos
115115
116116 // auxiliary data structures
117117
118- private case class MemoEntry [+ T ](var r : Either [LR ,ParseResult [_ ]]){
118+ private case class MemoEntry [+ T ](var r : Either [LR ,ParseResult [? ]]){
119119 def getResult : ParseResult [T ] = r match {
120120 case Left (LR (res,_,_)) => res.asInstanceOf [ParseResult [T ]]
121121 case Right (res) => res.asInstanceOf [ParseResult [T ]]
122122 }
123123 }
124124
125- private case class LR (var seed : ParseResult [_ ], var rule : Parser [_ ], var head : Option [Head ]){
125+ private case class LR (var seed : ParseResult [? ], var rule : Parser [? ], var head : Option [Head ]){
126126 def getPos : Position = getPosFromResult(seed)
127127 }
128128
129- private case class Head (var headParser : Parser [_ ], var involvedSet : List [Parser [_ ]], var evalSet : List [Parser [_ ]]){
129+ private case class Head (var headParser : Parser [? ], var involvedSet : List [Parser [? ]], var evalSet : List [Parser [? ]]){
130130 def getHead = headParser
131131 }
132132
@@ -152,7 +152,7 @@ trait PackratParsers extends Parsers {
152152 * In the former case, it makes sure that rules involved in the recursion are evaluated.
153153 * It also prevents non-involved rules from getting evaluated further
154154 */
155- private def recall (p : super .Parser [_ ], in : PackratReader [Elem ]): Option [MemoEntry [_ ]] = {
155+ private def recall (p : super .Parser [? ], in : PackratReader [Elem ]): Option [MemoEntry [? ]] = {
156156 val cached = in.getFromCache(p)
157157 val head = in.recursionHeads.get(in.pos)
158158
@@ -170,7 +170,7 @@ trait PackratParsers extends Parsers {
170170 h.evalSet = h.evalSet.filterNot(_== p)
171171 val tempRes = p(in)
172172 // we know that cached has an entry here
173- val tempEntry : MemoEntry [_ ] = cached.get // match {case Some(x: MemoEntry[_]) => x}
173+ val tempEntry : MemoEntry [? ] = cached.get // match {case Some(x: MemoEntry[_]) => x}
174174 // cache is modified
175175 tempEntry.r = Right (tempRes)
176176 }
@@ -184,7 +184,7 @@ trait PackratParsers extends Parsers {
184184 * we modify the involvedSets of all LRs in the stack, till we see
185185 * the current parser again
186186 */
187- private def setupLR (p : Parser [_ ], in : PackratReader [_ ], recDetect : LR ): Unit = {
187+ private def setupLR (p : Parser [? ], in : PackratReader [? ], recDetect : LR ): Unit = {
188188 if (recDetect.head.isEmpty) recDetect.head = Some (Head (p, Nil , Nil ))
189189
190190 in.lrStack.takeWhile(_.rule != p).foreach {x =>
@@ -272,7 +272,7 @@ to update each parser involved in the recursion.
272272 // all setupLR does is change the heads of the recursions, so the seed will stay the same
273273 recDetect match {case LR (seed, _, _) => seed.asInstanceOf [ParseResult [T ]]}
274274 }
275- case MemoEntry (Right (res : ParseResult [_ ])) => res.asInstanceOf [ParseResult [T ]]
275+ case MemoEntry (Right (res : ParseResult [? ])) => res.asInstanceOf [ParseResult [T ]]
276276 }
277277 }
278278 }
@@ -299,7 +299,7 @@ to update each parser involved in the recursion.
299299 // we're done with growing, we can remove data from recursion head
300300 rest.recursionHeads -= rest.pos
301301 rest.getFromCache(p).get match {
302- case MemoEntry (Right (x : ParseResult [_ ])) => x.asInstanceOf [ParseResult [T ]]
302+ case MemoEntry (Right (x : ParseResult [? ])) => x.asInstanceOf [ParseResult [T ]]
303303 case _ => throw new Exception (" impossible match" )
304304 }
305305 }
0 commit comments