Skip to content

Commit

Permalink
Merge pull request #183 from nafg/update-versions-yaml
Browse files Browse the repository at this point in the history
Update versions.yaml
  • Loading branch information
nafg authored May 24, 2024
2 parents 9adac73 + 6da2f3b commit 03c5dbd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
10 changes: 7 additions & 3 deletions project/FastParseParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object FastParseParser {

private def untilLineEnd[_: P] = P(CharsWhile(_ != '\n', 0).! ~ lineEnd)

private def extraLines[_: P] = P((" ".rep(10) ~ spaces ~ untilLineEnd).rep)
private def extraLines[_: P] = P((" ".rep(10) ~ spaces ~ !"-" ~ untilLineEnd).rep)

private def letters[_: P] = P(CharsWhile(_.isLetter))

Expand Down Expand Up @@ -106,13 +106,16 @@ object FastParseParser {
}
}

private val ansiRegex = "\u001B\\[[;\\d]*m".r

/** @param text
* output of scalac help output
* @return
* a Map of section descriptions to settings within them
*/
def parse(text: String): Map[String, Seq[Setting]] =
fastparse.parse(text, parser(_), verboseFailures = true) match {
def parse(text: String): Map[String, Seq[Setting]] = {
val textWithoutANSI = ansiRegex.replaceAllIn(text, "")
fastparse.parse(textWithoutANSI, parser(_), verboseFailures = true) match {
case Parsed.Success(groups, index) =>
val asMap = groups.toMap.map { case (name, settings) =>
if (name.trim == "Deprecated settings:")
Expand All @@ -133,4 +136,5 @@ object FastParseParser {
printFailureLocation(text, failure.index)
throw new Exception(s"Parse Error, ${failure.msg}")
}
}
}
2 changes: 1 addition & 1 deletion project/GetHelpString.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object GetHelpString {
files.mkString(File.pathSeparator),
mainClass,
flag
).call(stderr = os.Pipe)
).call(stderr = os.Pipe, env = Map("COLUMNS" -> "20000"))
}
geny.ByteData.Chunks(commandResult.chunks.map(_.merge)).trim()
}
Expand Down
36 changes: 33 additions & 3 deletions versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
- lit: '-language:'
- param: features
12:
0..14:
0..19:
helpFlags: [ -help, -X, -Y ]
settings:
language:
- lit: '-language:'
- param: features
13:
0..8:
0..14:
helpFlags: [ -help, -V, -W, -X, -Y ]
3:
0:
Expand All @@ -28,7 +28,37 @@
- lit: '-language:'
- param: features
1:
0..1:
0..3:
helpFlags: [ -help, -W, -X, -Y ]
settings:
encoding:
- lit: '-encoding '
- param: encoding
language:
- lit: '-language:'
- param: features
2:
0..2:
helpFlags: [ -help, -W, -X, -Y ]
settings:
encoding:
- lit: '-encoding '
- param: encoding
language:
- lit: '-language:'
- param: features
3:
0..3:
helpFlags: [ -help, -W, -X, -Y ]
settings:
encoding:
- lit: '-encoding '
- param: encoding
language:
- lit: '-language:'
- param: features
4:
0..2:
helpFlags: [ -help, -W, -X, -Y ]
settings:
encoding:
Expand Down

0 comments on commit 03c5dbd

Please sign in to comment.