Hi, could we allow Depend strings to contain tabs?
Depend
It is natural to want to use tabs when aligning dependencies in build.fan:
build.fan
depends = [ // ---- Fantom Core ----------------- "sys 1.0.70 - 1.0", "concurrent 1.0.70 - 1.0", "web 1.0.70 - 1.0", "dom 1.0.70 - 1.0", "domkit 1.0.70 - 1.0", ]
I know a few people who, after updating their build.fan, have been scratching their heads thinking the ParseErr refers to the versioning part.
ParseErr
The following patch shows the change should be pretty minor:
diff -r 52185c6ba69c src/sys/java/fan/sys/Depend.java --- a/src/sys/java/fan/sys/Depend.java Mon Aug 05 12:19:22 2019 -0400 +++ b/src/sys/java/fan/sys/Depend.java Tue Aug 06 19:45:04 2019 +0100 @@ -136,7 +136,7 @@ private void consumeSpaces() { - while (cur == ' ') consume(); + while (cur == ' ' || cur == '\t') consume(); } diff -r 52185c6ba69c src/sys/js/fan/Depend.js --- a/src/sys/js/fan/Depend.js Mon Aug 05 12:19:22 2019 -0400 +++ b/src/sys/js/fan/Depend.js Tue Aug 06 19:45:04 2019 +0100 @@ -270,7 +270,7 @@ fan.sys.DependParser.prototype.consumeSpaces = function() { - while (this.m_cur == 32) this.consume(); + while (this.m_cur == 32 || this.m_cur == 9) this.consume(); } diff -r 52185c6ba69c src/testSys/fan/DependTest.fan --- a/src/testSys/fan/DependTest.fan Mon Aug 05 12:19:22 2019 -0400 +++ b/src/testSys/fan/DependTest.fan Tue Aug 06 19:45:04 2019 +0100 @@ -107,6 +107,9 @@ verifyErr(ParseErr#) { x := Depend.fromStr(" 8") } verifyErr(ParseErr#) { x := Depend.fromStr(" foo 0") } verifyErr(ParseErr#) { x := Depend.fromStr("foo\n1.8") } + + d = Depend.fromStr("foo\t\t\t1.2") + verifyEq(d.toStr, "foo 1.2") }
I pushed that change
Login or Signup to reply.
SlimerDude Tue 6 Aug 2019
Hi, could we allow
Depend
strings to contain tabs?It is natural to want to use tabs when aligning dependencies in
build.fan
:I know a few people who, after updating their build.fan, have been scratching their heads thinking the
ParseErr
refers to the versioning part.The following patch shows the change should be pretty minor:
brian Tue 6 Aug 2019
I pushed that change