On Mon, 21 May 2018 21:52:48 +0000 (UTC)
Jilles Tjoelker <jil...@freebsd.org> wrote:

> Author: jilles
> Date: Mon May 21 21:52:48 2018
> New Revision: 334008
> URL: https://svnweb.freebsd.org/changeset/base/334008
> 
> Log:
>   sh: Split CNL syntax category to avoid a check on state[level].syntax
>   
>   No functional change is intended.
> 
> Modified:
>   head/bin/sh/mksyntax.c
>   head/bin/sh/parser.c
> 
> Modified: head/bin/sh/mksyntax.c
> ==============================================================================
> --- head/bin/sh/mksyntax.c    Mon May 21 21:44:47 2018        (r334007)
> +++ head/bin/sh/mksyntax.c    Mon May 21 21:52:48 2018        (r334008)
> @@ -65,6 +65,7 @@ struct synclass {
>  static const struct synclass synclass[] = {
>       { "CWORD",      "character is nothing special" },
>       { "CNL",        "newline character" },
> +     { "CQNL",       "newline character in quotes" },
>       { "CBACK",      "a backslash character" },
>       { "CSBACK",     "a backslash character in single quotes" },
>       { "CSQUOTE",    "single quote" },
> @@ -185,7 +186,7 @@ main(int argc __unused, char **argv __unused)
>       fputs("\n/* syntax table used when in double quotes */\n", cfile);
>       init("dqsyntax");
>       add_default();
> -     add("\n", "CNL");
> +     add("\n", "CQNL");
>       add("\\", "CBACK");
>       add("\"", "CENDQUOTE");
>       add("`", "CBQUOTE");
> @@ -198,7 +199,7 @@ main(int argc __unused, char **argv __unused)
>       fputs("\n/* syntax table used when in single quotes */\n", cfile);
>       init("sqsyntax");
>       add_default();
> -     add("\n", "CNL");
> +     add("\n", "CQNL");
>       add("\\", "CSBACK");
>       add("'", "CENDQUOTE");
>       /* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */
> @@ -208,7 +209,7 @@ main(int argc __unused, char **argv __unused)
>       fputs("\n/* syntax table used when in arithmetic */\n", cfile);
>       init("arisyntax");
>       add_default();
> -     add("\n", "CNL");
> +     add("\n", "CQNL");
>       add("\\", "CBACK");
>       add("`", "CBQUOTE");
>       add("\"", "CIGN");
> 
> Modified: head/bin/sh/parser.c
> ==============================================================================
> --- head/bin/sh/parser.c      Mon May 21 21:44:47 2018        (r334007)
> +++ head/bin/sh/parser.c      Mon May 21 21:52:48 2018        (r334008)
> @@ -1434,9 +1434,10 @@ readtoken1(int firstc, char const *initialsyntax, cons
>  
>                       switch(synentry) {
>                       case CNL:       /* '\n' */
> -                             if (level == 0 &&
> -                                 state[level].syntax == BASESYNTAX)
> +                             if (level == 0)
>                                       goto endword;   /* exit outer
> loop */
> +                             /* FALLTHROUGH */
> +                     case CQNL:
>                               USTPUTC(c, out);
>                               plinno++;
>                               if (doprompt)
> _______________________________________________
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Have this been tested? Doesn't compile for me:

[...]
Building /usr/obj/usr/src/amd64.amd64/kerberos5/libexec/hprop/hprop
--- all_subdir_rescue ---
--- parser.o ---
/usr/src/bin/sh/parser.c:1440:9: error: use of undeclared identifier 'CQNL'
                        case CQNL:
                             ^
--- all_subdir_gnu ---
Building /usr/obj/usr/src/amd64.amd64/gnu/usr.bin/gdb/libgdb/amd64bsd-nat.o
--- all_subdir_rescue ---
1 error generated.
*** [parser.o] Error code 1

make[6]: stopped in /usr/src/bin/sh
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to