# HG changeset patch # User John W. Eaton # Date 1377291229 14400 # Node ID 4c1ae06111c9dccb214491c758b3ceaa4a9c61b3 # Parent 199444fc2c6b27cb0fac79fcf413ae26ac8c51f2 allow parser to accept empty statements (bug #37099) * oct-parse.in.yy (input1): Delete non-terminal. (input, simple_list): Simplify. Allow separators at beginning of statement or as only elements on line. diff -r 199444fc2c6b -r 4c1ae06111c9 libinterp/parse-tree/oct-parse.in.yy --- a/libinterp/parse-tree/oct-parse.in.yy Fri Aug 23 11:25:33 2013 -0700 +++ b/libinterp/parse-tree/oct-parse.in.yy Fri Aug 23 16:53:49 2013 -0400 @@ -264,7 +264,7 @@ %type declaration %type statement function_end classdef_end %type simple_list simple_list1 list list1 -%type opt_list input1 +%type opt_list // These types need to be specified. %type attr %type class_event @@ -307,33 +307,24 @@ // Statements and statement lists // ============================== -input : input1 +input : simple_list '\n' { parser.stmt_list = $1; YYACCEPT; } + | simple_list END_OF_INPUT + { + lexer.end_of_input = true; + parser.stmt_list = $1; + YYACCEPT; + } | simple_list parse_error { ABORT_PARSE; } - | parse_error - { ABORT_PARSE; } ; -input1 : '\n' +simple_list : opt_sep_no_nl { $$ = 0; } - | END_OF_INPUT - { - lexer.end_of_input = true; - $$ = 0; - } - | simple_list - { $$ = $1; } - | simple_list '\n' - { $$ = $1; } - | simple_list END_OF_INPUT - { $$ = $1; } - ; - -simple_list : simple_list1 opt_sep_no_nl + | simple_list1 opt_sep_no_nl { $$ = parser.set_stmt_print_flag ($1, $2, false); } ;