changeset 22879:194481349d22 stable

don't require semicolon between property list elements (bug #49819) * oct-parse.in.yy (property_list): Require separator between list elements, but not at the end of the list. * test/classdef/plist_t1.m, test/classdef/plist_t2.m, test/classdef/plist_t3.m: New files. * classdef.tst: New tests.
author John W. Eaton <jwe@octave.org>
date Sat, 10 Dec 2016 11:35:23 -0500
parents 691d81fc885b
children a13e9853b678 0419dec5d5c1
files libinterp/parse-tree/oct-parse.in.yy test/classdef/classdef.tst test/classdef/plist_t1.m test/classdef/plist_t2.m test/classdef/plist_t3.m
diffstat 5 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Fri Dec 09 13:23:50 2016 -0800
+++ b/libinterp/parse-tree/oct-parse.in.yy	Sat Dec 10 11:35:23 2016 -0500
@@ -1742,7 +1742,7 @@
 property_list
                 : class_property
                   { $$ = new tree_classdef_property_list ($1); }
-                | property_list opt_sep class_property
+                | property_list sep class_property
                   {
                     YYUSE ($2);
 
@@ -1753,7 +1753,7 @@
 
 class_property  : identifier
                   { $$ = new tree_classdef_property ($1); }
-                | identifier '=' decl_param_init expression ';'
+                | identifier '=' decl_param_init expression
                   {
                     YYUSE ($2);
 
--- a/test/classdef/classdef.tst	Fri Dec 09 13:23:50 2016 -0800
+++ b/test/classdef/classdef.tst	Sat Dec 10 11:35:23 2016 -0500
@@ -71,3 +71,7 @@
 %! obj = foo_method_changes_property_size (3);
 %! obj = obj.move_element_to_end (2);
 %! assert (obj.element, [1 3 2]);
+
+%!error <parse error> plist_t1
+%!assert (class (plist_t2), "plist_t2")
+%!assert (class (plist_t3), "plist_t3")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/classdef/plist_t1.m	Sat Dec 10 11:35:23 2016 -0500
@@ -0,0 +1,5 @@
+classdef plist_t1
+  properties
+    a = 1 b
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/classdef/plist_t2.m	Sat Dec 10 11:35:23 2016 -0500
@@ -0,0 +1,5 @@
+classdef plist_t2
+  properties
+    a = 1; b
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/classdef/plist_t3.m	Sat Dec 10 11:35:23 2016 -0500
@@ -0,0 +1,6 @@
+classdef plist_t3
+  properties
+    a = 1
+    b
+  end
+end