From 6f35998ea70a845e762ec234aa097d1fe414ecf3 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sat, 14 Dec 2019 22:14:53 +0300 Subject: [PATCH] extend NEW syntax --- src/generic/Dev/Mod/CPR.cp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/generic/Dev/Mod/CPR.cp b/src/generic/Dev/Mod/CPR.cp index aaf4c8a..03c3fe4 100644 --- a/src/generic/Dev/Mod/CPR.cp +++ b/src/generic/Dev/Mod/CPR.cp @@ -84,14 +84,15 @@ MODULE DevCPR; END END Get; - PROCEDURE New (IN name: DevCPT.Name; val: BOOLEAN); + PROCEDURE New (IN name: DevCPT.Name; val: BOOLEAN): Selector; VAR s: Selector; BEGIN s := scope; WHILE (s.next # NIL) & (s.next.name$ # name$) DO s := s.next END; IF s.next = NIL THEN NEW(s.next); s.next.name := name$; s.next.val := val ELSE err(1) - END + END; + RETURN s.next END New; PROCEDURE Old (IN name: DevCPT.Name): Selector; @@ -204,13 +205,16 @@ MODULE DevCPR; END Printable; PROCEDURE Parse*; - VAR val: BOOLEAN; + VAR val: BOOLEAN; s: Selector; BEGIN Get(sym); IF sym = new THEN Get(sym); - IF sym = ident THEN New(name, FALSE); Get(sym) + IF sym = ident THEN s := New(name, FALSE); Get(sym) ELSE err(48) + END; + IF (sym = plus) OR (sym = minus) THEN + s.val := sym = plus; Get(sym) END ELSIF sym = error THEN IF Printable() THEN err(501) END; Get(sym) @@ -260,8 +264,8 @@ MODULE DevCPR; Close; If(TRUE); NEW(scope); - New("TRUE", TRUE); - New("FALSE", FALSE) + Set("TRUE", TRUE); + Set("FALSE", FALSE) END Init; END DevCPR. -- 2.29.2