From 0fff05884fe4b40c86252e89fb16f307309299cd Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sat, 18 Dec 2021 20:29:30 +1100 Subject: [PATCH] oceani: fix parsing of error in struct field. If there is an error - we violated our segments. Signed-off-by: NeilBrown --- csrc/oceani-tests.mdc | 4 +++- csrc/oceani.mdc | 15 +++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/csrc/oceani-tests.mdc b/csrc/oceani-tests.mdc index b613ffe..e502822 100644 --- a/csrc/oceani-tests.mdc +++ b/csrc/oceani-tests.mdc @@ -922,7 +922,7 @@ various places that `type_err()` are called. struct foo a: number - b:string = "hello" + b:string = "hello"; d:Boolean func main() c := "hello" @@ -1033,10 +1033,12 @@ various places that `type_err()` are called. b:string struct foo c:number + x:[5]:string ###### output: type_err5 .tmp.code:8:7: error: type already declared: foo .tmp.code:2:7: info: this is location of declartion: foo + .tmp.code:10:13: Syntax error in struct field: : .tmp.code:5:7: error: type has recursive definition: baz .tmp.code:2:7: error: type has recursive definition: foo diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index 0778da2..2f3c973 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -2969,10 +2969,17 @@ function will be needed. | SimpleFieldList EOL ${ $0 = $ SimpleFieldList Newlines ${ $0 = $prev = $prev) + f = f->prev; + f->prev = $ Field ${ $0 = $