@@ -9,28 +9,29 @@ import scala.build.preprocessing.directives.Directive
99object TemporaryDirectivesParser {
1010
1111 private def ws [_ : P ] = P (" " .rep(1 ))
12+ private def optWs [_ : P ] = P (" " .rep(0 ))
1213 private def nl [_ : P ] = P ((" \r " .? ~ " \n " ).rep(1 ))
1314 private def emptyLine [_ : P ] = P (ws.rep() ~ nl)
1415
1516 private def singleLineComment [_ : P ] =
16- P (ws.rep() ~ ! (" //" ~ ws ~ " require" ) ~ ! (" //" ~ ws ~ " using" ) ~ " //" ~ P (CharPred (c =>
17+ P (ws.rep() ~ ! (" //" ~ optWs ~ " require" ) ~ ! (" //" ~ optWs ~ " using" ) ~ " //" ~ P (CharPred (c =>
1718 c != '\n '
1819 )).rep() ~ nl)
1920 .map(_ => ())
2021
2122 private def directive [_ : P ] = {
2223 def sc = P (" ;" )
2324 def tpe = {
24- def commentedUsingTpe = P (" //" ~ ws ~ Index ~ " using" )
25+ def commentedUsingTpe = P (" //" ~ optWs ~ Index ~ " using" )
2526 .map(actualStartIdx => (Directive .Using : Directive .Type , Some (actualStartIdx)))
2627 def usingKeywordTpe = P (" using" )
2728 .map(_ => (Directive .Using : Directive .Type , None ))
2829 def usingTpe = P (ws.? ~ (commentedUsingTpe | usingKeywordTpe) ~ ! (ws ~ " target" ))
29- def commentedRequireTpe = P (" //" ~ ws ~ Index ~ " require" )
30+ def commentedRequireTpe = P (" //" ~ optWs ~ Index ~ " require" )
3031 .map(actualStartIdx => (Directive .Require : Directive .Type , Some (actualStartIdx)))
3132 def requireKeywordTpe = P (" require" )
3233 .map(_ => (Directive .Require : Directive .Type , None ))
33- def commentedUsingTargetTpe = P (" //" ~ ws ~ Index ~ " using" ~ ws ~ " target" )
34+ def commentedUsingTargetTpe = P (" //" ~ optWs ~ Index ~ " using" ~ ws ~ " target" )
3435 .map(actualStartIdx => (Directive .Require : Directive .Type , Some (actualStartIdx)))
3536 def usingTargetKeywordTpe = P (" using" ~ ws ~ " target" )
3637 .map(_ => (Directive .Require : Directive .Type , None ))
0 commit comments