#include "lkc.h"
+#define YY_DECL static int yylex1(void)
+
#define START_STRSIZE 16
static struct {
int lineno;
} current_pos;
+static int prev_token = T_EOL;
static char *text;
static int text_size, text_asize;
}
%%
+
+/* second stage lexer */
+int yylex(void)
+{
+ int token;
+
+repeat:
+ token = yylex1();
+
+ /* Do not pass unneeded T_EOL to the parser. */
+ if ((prev_token == T_EOL || prev_token == T_HELPTEXT) && token == T_EOL)
+ goto repeat;
+
+ prev_token = token;
+
+ return token;
+}
+
static char *expand_token(const char *in, size_t n)
{
char *out;
static struct menu *current_menu, *current_entry;
%}
-%expect 29
+%expect 21
%union
{
%}
%%
-input: nl start | start;
-
-start: mainmenu_stmt stmt_list | stmt_list;
+input: mainmenu_stmt stmt_list | stmt_list;
/* mainmenu entry */
;
common_stmt:
- T_EOL
- | if_stmt
+ if_stmt
| comment_stmt
| config_stmt
| menuconfig_stmt
| config_option_list depends
| config_option_list help
| config_option_list option_error
- | config_option_list T_EOL
;
config_option: T_TYPE prompt_stmt_opt T_EOL
| choice_option_list choice_option
| choice_option_list depends
| choice_option_list help
- | choice_option_list T_EOL
| choice_option_list option_error
;
depends_list:
/* empty */
| depends_list depends
- | depends_list T_EOL
| depends_list option_error
;
visibility_list:
/* empty */
| visibility_list visible
- | visibility_list T_EOL
;
visible: T_VISIBLE if_expr T_EOL
| T_ENDIF T_EOL { $$ = $1; }
;
-nl:
- T_EOL
- | nl T_EOL
-;
-
if_expr: /* empty */ { $$ = NULL; }
| T_IF expr { $$ = $2; }
;