NetBSD/src ITX1Dgpbin/sh parser.c

   lexical analysis fixes.   This fixes the tests just committed in
   src/tests/bin/sh/t_here.sh

   The "magicq" magic was all wrong - it cannot be simply a parameter
   to readtoken1() as its value needs to alter during that routine
   (eg: when magicq is set - processing here doc text, or whatever)
   and we encountered ${var%pattern} "magicq" needs to be off for
   "pattern" - and it wasn't.

   To handle this magicq needs to be included in the token stack struct,
   and simply init'd from the arg to readtoken1 (which we rename).
   Then it can be manipulated as required.

   Once we no longer have that problem, some other issues can be cleaned
   up as well (some of this unbelievably fragile code was attempting to
   cope with this in various ad-hoc - and mostly broken - ways).

   Also, remove the magicq parameter from parsebackq() - it was not
   used (at all) and should never be, a command substitution, wherever
   it appears, always starts a new parsing context.  How that applies
   to old style command substitutions is less clear, but until we see
   some real examples where we're not doing the right thing (slightly
   less likely now than before ... nothing has changed here in the
   way command substitutions are parsed, but quoting in general is
   slightly better) I don't plan on worrying about it.

   There are a couple of other minor cleanups, which make no actual
   difference (like adding () around the use of the parameter in the
   RETURN macro ... which is generally better, but makes no difference
   here as the param is always a simple constant.

   All the current ATF tests pass.
VersionDeltaFile
1.164+18-12bin/sh/parser.c
+18-121 files

UnifiedSplitRaw