mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-26 20:33:02 +00:00
Add -Xd and -Xr command line options
This commit is contained in:
parent
7fe32ca564
commit
4191eec7f8
@ -683,6 +683,9 @@ object Main {
|
||||
|
||||
fluff("", "Other options:", "")
|
||||
|
||||
expansion("-Xd")("-O1", "-s", "-fsource-in-asm", "-g").description("Do a debug build. Equivalent to -O1 -s -fsource-in-asm -g")
|
||||
expansion("-Xr")("-O4", "-s", "-fsource-in-asm", "-finline", "-fipo", "-foptimize-stdlib").description("Do a release build. Equivalent to -O4 -s -fsource-in-asm -finline -fipo -foptimize-stdlib")
|
||||
|
||||
flag("--single-threaded").action(c =>
|
||||
c.changeFlag(CompilationFlag.SingleThreaded, true)
|
||||
).description("Run the compiler in a single thread.")
|
||||
|
@ -208,4 +208,12 @@ class ParamOption[T](val names: Seq[String]) extends CliOption[T, ParamOption[T]
|
||||
}
|
||||
|
||||
override val _shortName = names.head
|
||||
}
|
||||
|
||||
class ExpansionOption[T](val name: String)(val replacements: List[String]) extends CliOption[T, ExpansionOption[T]] {
|
||||
override def names: Seq[String] = Seq(name)
|
||||
|
||||
override private[cli] def length = 1
|
||||
|
||||
override private[cli] val _shortName = name
|
||||
}
|
@ -12,11 +12,12 @@ class CliParser[T] {
|
||||
private val options = mutable.ArrayBuffer[CliOption[T, _]]()
|
||||
private val mapFlags = mutable.Map[String, CliOption[T, _]]()
|
||||
private val mapOptions = mutable.Map[String, CliOption[T, _]]()
|
||||
private val mapExpansions = mutable.Map[String, List[String]]()
|
||||
private val _default = new UnknownParamOption[T]().action((p, _) => throw new IllegalArgumentException(s"Unknown option $p"))
|
||||
private var _status: Option[CliStatus.Value] = None
|
||||
options += _default
|
||||
|
||||
private def add[O <: CliOption[T, _]](o: O) = {
|
||||
private def add[O <: CliOption[T, _]](o: O): O = {
|
||||
options += o
|
||||
o.length match {
|
||||
case 1 =>
|
||||
@ -46,6 +47,8 @@ class CliParser[T] {
|
||||
}
|
||||
case k :: xs if mapFlags.contains(k) =>
|
||||
mapFlags(k) match {
|
||||
case p: ExpansionOption[T] if !p._dummy =>
|
||||
parseInner(context, p.replacements ++ xs)
|
||||
case p: FlagOption[T] if !p._dummy =>
|
||||
parseInner(p.encounter(context), xs)
|
||||
case p: BooleanOption[T] if !p._dummy =>
|
||||
@ -78,4 +81,6 @@ class CliParser[T] {
|
||||
|
||||
def parameter(names: String*): ParamOption[T] = add(new ParamOption[T](names))
|
||||
|
||||
def expansion(name: String)(replacements: String*): ExpansionOption[T] = add(new ExpansionOption[T](name)(replacements.toList))
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user