aboutsummaryrefslogtreecommitdiff
path: root/src/boot/strap/parser.clisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/strap/parser.clisp')
-rw-r--r--src/boot/strap/parser.clisp35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp
index 85db17da..fa16a127 100644
--- a/src/boot/strap/parser.clisp
+++ b/src/boot/strap/parser.clisp
@@ -462,7 +462,7 @@
(|bpPush| (|%TypeAlias| (|bpPop2|) (|bpPop1|)))))
(DEFUN |bpSignature| ()
- (AND (|bpName|) (|bpEqKey| 'COLON) (|bpTyping|)
+ (AND (|bpName|) (|bpEqKey| 'COLON) (|bpRequire| #'|bpTyping|)
(|bpPush| (|%Signature| (|bpPop2|) (|bpPop1|)))))
(DEFUN |bpSimpleMapping| ()
@@ -1098,9 +1098,40 @@
(DEFUN |bpStruct| ()
(AND (|bpEqKey| 'STRUCTURE) (|bpRequire| #'|bpName|)
- (OR (|bpEqKey| 'DEF) (|bpTrap|)) (|bpTypeList|)
+ (OR (|bpEqKey| 'DEF) (|bpTrap|)) (OR (|bpRecord|) (|bpTypeList|))
(|bpPush| (|%Structure| (|bpPop2|) (|bpPop1|)))))
+(DEFUN |bpRecord| ()
+ (LET* (|s|)
+ (PROGN
+ (SETQ |s| (|bpState|))
+ (COND
+ ((AND (|bpName|) (EQ (|bpPop1|) '|Record|))
+ (AND (OR (|bpParenthesized| #'|bpFieldList|) (|bpTrap|))
+ (|bpGlobalAccessors|)
+ (|bpPush| (|%Record| (|bfUntuple| (|bpPop2|)) (|bpPop1|)))))
+ (T (|bpRestore| |s|) NIL)))))
+
+(DEFUN |bpFieldList| () (|bpTuple| #'|bpSignature|))
+
+(DEFUN |bpGlobalAccessors| ()
+ (COND
+ ((|bpEqKey| 'WITH)
+ (OR (|bpPileBracketed| #'|bpAccessorDefinitionList|) (|bpTrap|)))
+ (T (|bpPush| NIL))))
+
+(DEFUN |bpAccessorDefinitionList| ()
+ (|bpListAndRecover| #'|bpAccessorDefinition|))
+
+(DEFUN |bpAccessorDefinition| ()
+ (AND (|bpRequire| #'|bpName|) (OR (|bpEqKey| 'DEF) (|bpTrap|))
+ (|bpRequire| #'|bpFieldSection|)
+ (|bpPush| (|%AccessorDef| (|bpPop2|) (|bpPop1|)))))
+
+(DEFUN |bpFieldSection| () (|bpParenthesized| #'|bpSelectField|))
+
+(DEFUN |bpSelectField| () (AND (|bpEqKey| 'DOT) (|bpName|)))
+
(DEFUN |bpTypeList| ()
(OR (|bpPileBracketed| #'|bpTypeItemList|)
(AND (|bpTypeItem|) (|bpPush| (LIST (|bpPop1|))))))