summaryrefslogtreecommitdiff
path: root/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/parser.rs b/src/parser.rs
index d1fe4d7..4f7ff6a 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -35,6 +35,7 @@ impl<'a> Context<'a> {
35 self.cur[(self.icur+1)%2] 35 self.cur[(self.icur+1)%2]
36 } 36 }
37 37
38 /*
38 pub fn check_unwrapped<T: Fn( &SymbolType, &SymbolType ) -> bool>(&self, context: &str, f: T) -> CrimResult<bool> { 39 pub fn check_unwrapped<T: Fn( &SymbolType, &SymbolType ) -> bool>(&self, context: &str, f: T) -> CrimResult<bool> {
39 if self.cur().is_none() || self.peek().is_none() { 40 if self.cur().is_none() || self.peek().is_none() {
40 Err(CrimError::eos( context )) 41 Err(CrimError::eos( context ))
@@ -42,6 +43,7 @@ impl<'a> Context<'a> {
42 Ok(f( self.cur().unwrap().symbol(), self.peek().unwrap().symbol())) 43 Ok(f( self.cur().unwrap().symbol(), self.peek().unwrap().symbol()))
43 } 44 }
44 } 45 }
46 */
45 47
46 pub fn source(&self) -> usize { 48 pub fn source(&self) -> usize {
47 self.source 49 self.source
@@ -50,6 +52,7 @@ impl<'a> Context<'a> {
50 52
51trait SymbolHelper { 53trait SymbolHelper {
52 fn is<T: Fn( &SymbolType ) -> bool>(&self, context: &str, f: T ) -> CrimResult<bool>; 54 fn is<T: Fn( &SymbolType ) -> bool>(&self, context: &str, f: T ) -> CrimResult<bool>;
55 #[allow(dead_code)]
53 fn is_valid_tag_name(&self) -> CrimResult<bool>; 56 fn is_valid_tag_name(&self) -> CrimResult<bool>;
54} 57}
55 58
@@ -572,11 +575,11 @@ impl<'a> TagBuilder<'a> {
572 pub fn is_unary(&self) -> bool { 575 pub fn is_unary(&self) -> bool {
573 self.tag_type == TagType::Unary 576 self.tag_type == TagType::Unary
574 } 577 }
575 578/*
576 pub fn is_multinary_open(&self) -> bool { 579 pub fn is_multinary_open(&self) -> bool {
577 self.tag_type == TagType::MultinaryOpen 580 self.tag_type == TagType::MultinaryOpen
578 } 581 }
579 582*/
580 pub fn can_have_params(&self) -> bool { 583 pub fn can_have_params(&self) -> bool {
581 match self.name.unwrap().symbol() { 584 match self.name.unwrap().symbol() {
582 SymbolType::View | SymbolType::Output | SymbolType::Loop => true, 585 SymbolType::View | SymbolType::Output | SymbolType::Loop => true,
@@ -598,7 +601,7 @@ impl<'a> TagBuilder<'a> {
598 pub fn can_have_props(&self) -> bool { 601 pub fn can_have_props(&self) -> bool {
599 true 602 true
600 } 603 }
601 604/*
602 pub fn can_have_children(&self) -> bool { 605 pub fn can_have_children(&self) -> bool {
603 if self.tag_type == TagType::MultinaryOpen || 606 if self.tag_type == TagType::MultinaryOpen ||
604 self.tag_type == TagType::MultinaryMid { 607 self.tag_type == TagType::MultinaryMid {
@@ -607,7 +610,7 @@ impl<'a> TagBuilder<'a> {
607 false 610 false
608 } 611 }
609 } 612 }
610 613*/
611 pub fn is_name(&self, name: &SymbolType<'a>) -> bool { 614 pub fn is_name(&self, name: &SymbolType<'a>) -> bool {
612 if let Some(a) = self.name { 615 if let Some(a) = self.name {
613 a.symbol() == name 616 a.symbol() == name
@@ -619,11 +622,11 @@ impl<'a> TagBuilder<'a> {
619 pub fn name(&self) -> Option<Symbol<'a>> { 622 pub fn name(&self) -> Option<Symbol<'a>> {
620 self.name 623 self.name
621 } 624 }
622 625/*
623 pub fn params(&self) -> &Vec<ParamValue> { 626 pub fn params(&self) -> &Vec<ParamValue> {
624 &self.params 627 &self.params
625 } 628 }
626 629*/
627 pub fn set_name(&mut self, name: Symbol<'a>) { 630 pub fn set_name(&mut self, name: Symbol<'a>) {
628 self.name = Some(name); 631 self.name = Some(name);
629 } 632 }
@@ -639,19 +642,19 @@ impl<'a> TagBuilder<'a> {
639 pub fn add_child(&mut self, tb: Entry<'a>) { 642 pub fn add_child(&mut self, tb: Entry<'a>) {
640 self.children.push( tb ); 643 self.children.push( tb );
641 } 644 }
642 645/*
643 pub fn append_children(&mut self, children: &mut Vec::<Entry<'a>>) { 646 pub fn append_children(&mut self, children: &mut Vec::<Entry<'a>>) {
644 self.children.append( children ); 647 self.children.append( children );
645 } 648 }
646 649*/
647 pub fn add_chain(&mut self, tb: Entry<'a>) { 650 pub fn add_chain(&mut self, tb: Entry<'a>) {
648 self.chain.push( tb ); 651 self.chain.push( tb );
649 } 652 }
650 653/*
651 pub fn set_type(&mut self, tag_type: TagType) { 654 pub fn set_type(&mut self, tag_type: TagType) {
652 self.tag_type = tag_type; 655 self.tag_type = tag_type;
653 } 656 }
654 657*/
655 pub fn tag_type(&self) -> TagType { 658 pub fn tag_type(&self) -> TagType {
656 self.tag_type 659 self.tag_type
657 } 660 }