fn parse_toks(&mut self, toks: &Vec<lex::Token>) 
	{
		if toks.len() <= 0 {
			return;
		}
		
		match toks.get(0) 
		{
			&lex::Newline => { return; }
			
			&lex::Section(ref s) => { println!("Ignore Section: {}", s);  }
			
			//syntax: $ident : "data" (allow % )
			&lex::DataAddress(ref name) => {
				
				if toks.get(1) != &lex::Colon {
					println!("missing : after ${}", name);
				}

				match toks.get(2) 
				{
					&lex::StringLiteral(ref data) => {
							self.program.add_data(*name, data.as_bytes());
						}
					_ => { println!("invalid token after ${}:", name); }
				}
			}
			
			&lex::Label(ref name) => { self.program.add_label(*name); }
			&lex::Ident(_) => {self.parse_instruction(toks); }
			&lex::Macro(_) => {self.parse_instruction(toks); }
			
			
			//macro
			//ident
			
			//fails
			_ => { println!("Invalid token: {}", toks.get(0)); }
		}
	}
//get the token from one line so one instruction
get the token from one line so one instruction
get the token from one line so one instruction
fn parse_toks(&mut self, toks: &Vec<lex::Token>) 
	{
		if toks.len() <= 0 {
			return;
		}
		match toks.get(0) 
		{
			&lex::Newline => { return; }
			&lex::Section(ref s) => { println!("Ignore Section: {}", s);  }
			//syntax: $ident : "data" (allow % )
			&lex::DataAddress(ref name) => {
				if toks.get(1) != &lex::Colon {
					println!("missing : after ${}", name);
				}
				match toks.get(2) 
				{
					&lex::StringLiteral(ref data) => {
							self.program.add_data(*name, data.as_bytes());
						}
					_ => { println!("invalid token after ${}:", name); }
				}
			}
			&lex::Label(ref name) => { self.program.add_label(*name); }
			&lex::Ident(_) => {self.parse_instruction(toks); }
			&lex::Macro(_) => {self.parse_instruction(toks); }
			//macro
			//ident
			//fails
			_ => { println!("Invalid token: {}", toks.get(0)); }
		}
	}
fn parse_toks ( & mut self , toks : & Vec < lex :: Token > ) { if toks . len ( ) <= 0 { return ; } match toks . get ( 0 ) { & lex :: Newline => { return ; } & lex :: Section ( ref s ) => { println ! ( " " s ) ; } //syntax: $ident : "data" (allow % ) & lex :: DataAddress ( ref name ) => { if toks . get ( 1 ) != & lex :: Colon { println ! ( " " name ) ; } match toks . get ( 2 ) { & lex :: StringLiteral ( ref data ) => { self . program . add_data ( * name , data . as_bytes ( ) ) ; } _ => { println ! ( " " name ) ; } } } & lex :: Label ( ref name ) => { self . program . add_label ( * name ) ; } & lex :: Ident ( _ ) => { self . parse_instruction ( toks ) ; } & lex :: Macro ( _ ) => { self . parse_instruction ( toks ) ; } //macro //ident //fails _ => { println ! ( " " toks get ( 0 ) ) ; } } }
get the token from one line so one instruction
get the token from one line so one instruction
&mut self
toks
&Vec<lex::Token>
&mut self
toks
&Vec<lex::Token>