From 6a36c752cd1d199bf43d7f8bdead4e4496c8fba1 Mon Sep 17 00:00:00 2001 From: maxrdz Date: Wed, 6 Mar 2024 00:29:26 -0700 Subject: [PATCH] dcparser: dc_keyword_list production evaluates to DCKeywordList struct --- libdonet/src/dcparser.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libdonet/src/dcparser.rs b/libdonet/src/dcparser.rs index b2579c0..65d147d 100644 --- a/libdonet/src/dcparser.rs +++ b/libdonet/src/dcparser.rs @@ -350,19 +350,24 @@ parser! { class_field: () { // e.g. "setPos(float64 x, float64 y, float64 z) ram broadcast" - named_field dc_keyword_list => {}, + named_field dc_keyword_list[_] => {}, // e.g. "setStats : setAvatarCount, setNewAvatarCount" molecular_field => {}, } - dc_keyword_list: Vec { - epsilon => vec![], + dc_keyword_list: dckeyword::DCKeywordList { + epsilon => dckeyword::DCKeywordList::default(), + dc_keyword_list[mut kl] Identifier(k) => { - kl.push(k); + use dckeyword::{DCKeywordInterface, DCKeywordListInterface}; + + let _ = kl.add_keyword(dckeyword::DCKeyword::new(k, None)); kl } dc_keyword_list[mut kl] DCKeyword(k) => { - kl.push(k); + use dckeyword::{DCKeywordInterface, DCKeywordListInterface}; + + let _ = kl.add_keyword(dckeyword::DCKeyword::new(k, None)); kl } } @@ -370,7 +375,6 @@ parser! { optional_inheritance: Option> { epsilon => None, Colon Identifier(parent) class_parents[mut cp] => { - // TODO: Check if identifier is a defined class. cp.insert(0, parent); Some(cp) },