Skip to content

Commit

Permalink
dcparser: dc_keyword_list production evaluates to DCKeywordList struct
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrdz committed Mar 6, 2024
1 parent 158b08b commit 6a36c75
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions libdonet/src/dcparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,27 +350,31 @@ 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<String> {
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
}
}

optional_inheritance: Option<Vec<String>> {
epsilon => None,
Colon Identifier(parent) class_parents[mut cp] => {
// TODO: Check if identifier is a defined class.
cp.insert(0, parent);
Some(cp)
},
Expand Down

0 comments on commit 6a36c75

Please sign in to comment.