From: millert Date: Fri, 9 Oct 2015 19:49:08 +0000 (+0000) Subject: Lexer states are not needed outside of lex.c. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1bbe2e09f1462e788f2ec755d840d5befb3412c3;p=openbsd Lexer states are not needed outside of lex.c. From mksh via Michael McConville --- diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c index d6cfa5d5f51..d0dec05f99c 100644 --- a/bin/ksh/lex.c +++ b/bin/ksh/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.57 2015/10/05 23:32:15 nicm Exp $ */ +/* $OpenBSD: lex.c,v 1.58 2015/10/09 19:49:08 millert Exp $ */ /* * lexical analysis and source input @@ -9,6 +9,24 @@ #include +/* + * states while lexing word + */ +#define SBASE 0 /* outside any lexical constructs */ +#define SWORD 1 /* implicit quoting for substitute() */ +#define SLETPAREN 2 /* inside (( )), implicit quoting */ +#define SSQUOTE 3 /* inside '' */ +#define SDQUOTE 4 /* inside "" */ +#define SBRACE 5 /* inside ${} */ +#define SCSPAREN 6 /* inside $() */ +#define SBQUOTE 7 /* inside `` */ +#define SASPAREN 8 /* inside $(( )) */ +#define SHEREDELIM 9 /* parsing <<,<<- delimiter */ +#define SHEREDQUOTE 10 /* parsing " in <<,<<- delimiter */ +#define SPATTERN 11 /* parsing *(...|...) pattern (*+?@!) */ +#define STBRACE 12 /* parsing ${..[#%]..} */ +#define SBRACEQ 13 /* inside "${}" */ + /* Structure to keep track of the lexing state and the various pieces of info * needed for each particular state. */ diff --git a/bin/ksh/lex.h b/bin/ksh/lex.h index 114ea70bf8d..024e1d99d57 100644 --- a/bin/ksh/lex.h +++ b/bin/ksh/lex.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.h,v 1.14 2015/10/05 23:32:15 nicm Exp $ */ +/* $OpenBSD: lex.h,v 1.15 2015/10/09 19:49:08 millert Exp $ */ /* * Source input, lexer and parser @@ -48,24 +48,6 @@ struct source { #define SF_ALIASEND BIT(2) /* faking space at end of alias */ #define SF_TTY BIT(3) /* type == SSTDIN & it is a tty */ -/* - * states while lexing word - */ -#define SBASE 0 /* outside any lexical constructs */ -#define SWORD 1 /* implicit quoting for substitute() */ -#define SLETPAREN 2 /* inside (( )), implicit quoting */ -#define SSQUOTE 3 /* inside '' */ -#define SDQUOTE 4 /* inside "" */ -#define SBRACE 5 /* inside ${} */ -#define SCSPAREN 6 /* inside $() */ -#define SBQUOTE 7 /* inside `` */ -#define SASPAREN 8 /* inside $(( )) */ -#define SHEREDELIM 9 /* parsing <<,<<- delimiter */ -#define SHEREDQUOTE 10 /* parsing " in <<,<<- delimiter */ -#define SPATTERN 11 /* parsing *(...|...) pattern (*+?@!) */ -#define STBRACE 12 /* parsing ${..[#%]..} */ -#define SBRACEQ 13 /* inside "${}" */ - typedef union { int i; char *cp;