ozancicek commented on a change in pull request #24939: 
[SPARK-18569][ML][R]Support RFormula arithmetic, I() and spark functions
URL: https://github.com/apache/spark/pull/24939#discussion_r296620061
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/ml/feature/RFormulaParser.scala
 ##########
 @@ -269,40 +310,78 @@ private[ml] object RFormulaParser extends RegexParsers {
   }
 
   private val intercept: Parser[Term] =
-    "([01])".r ^^ { case a => Intercept(a == "1") }
+    "([01])".r.n ^^ { case a => Intercept(a == "1") }
 
 Review comment:
   Just introduced a shorter way of escaping whitespace around the tokens. Uses 
the implicit class defined inside the object on line 290:
   
   ```scala
     private val space = "[ \\n]*".r
   
     /* Utility function for skipping whitespace around a regex. */
     private implicit class RegexParserUtils(val r: Regex) {
       def n: Parser[String] = (space ~> r <~ space)
     }
   
   ```
   Given a regexp, returns a string parser which skips the surrounding white 
space

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to