• Home
  • Raw
  • Download

Lines Matching full:instructions

6 /// template strings and generating the appropriate bytecode instructions.
27 /// instructions based on it. The parser is a simple hand-written pattern-matching parser with no
32 instructions: Vec<Instruction<'template>>, field
45 instructions: vec![], in new()
80 .push((discriminant, Block::Branch(self.instructions.len()))); in compile()
81 self.instructions in compile()
86 let num_instructions = self.instructions.len() + 1; in compile()
89 .push((discriminant, Block::Branch(self.instructions.len()))); in compile()
90 self.instructions.push(Instruction::Goto(UNKNOWN)) in compile()
94 let num_instructions = self.instructions.len(); in compile()
100 self.instructions.push(instruction); in compile()
106 self.instructions.push(Instruction::PopContext) in compile()
116 self.instructions in compile()
119 .push((discriminant, Block::For(self.instructions.len()))); in compile()
120 self.instructions.push(Instruction::Iterate(UNKNOWN)); in compile()
124 let num_instructions = self.instructions.len() + 1; in compile()
126 self.instructions.push(Instruction::Goto(goto_target)); in compile()
127 self.instructions.push(Instruction::PopContext); in compile()
131 self.instructions.push(Instruction::Call(name, path)); in compile()
151 self.instructions.push(instruction); in compile()
165 self.instructions.push(Instruction::Literal(text)); in compile()
181 Ok(self.instructions) in compile()
225 match &mut self.instructions[index] { in close_branch()
251 match &mut self.instructions[index] { in close_for()
313 if let Some(Instruction::Literal(text)) = self.instructions.last_mut() { in trim_last_whitespace()
431 let instructions = compile(text).unwrap(); in test_compile_literal() localVariable
432 assert_eq!(1, instructions.len()); in test_compile_literal()
433 assert_eq!(&Literal(text), &instructions[0]); in test_compile_literal()
439 let instructions = compile(text).unwrap(); in test_compile_value() localVariable
440 assert_eq!(1, instructions.len()); in test_compile_value()
441 assert_eq!(&Value(vec![PathStep::Name("foobar")]), &instructions[0]); in test_compile_value()
447 let instructions = compile(text).unwrap(); in test_compile_value_with_formatter() localVariable
448 assert_eq!(1, instructions.len()); in test_compile_value_with_formatter()
451 &instructions[0] in test_compile_value_with_formatter()
458 let instructions = compile(text).unwrap(); in test_dotted_path() localVariable
459 assert_eq!(1, instructions.len()); in test_dotted_path()
462 &instructions[0] in test_dotted_path()
469 let instructions = compile(text).unwrap(); in test_indexed_path() localVariable
470 assert_eq!(1, instructions.len()); in test_indexed_path()
477 &instructions[0] in test_indexed_path()
484 let instructions = compile(text).unwrap(); in test_mixture() localVariable
485 assert_eq!(3, instructions.len()); in test_mixture()
486 assert_eq!(&Literal("Hello "), &instructions[0]); in test_mixture()
487 assert_eq!(&Value(vec![PathStep::Name("name")]), &instructions[1]); in test_mixture()
488 assert_eq!(&Literal(", how are you?"), &instructions[2]); in test_mixture()
494 let instructions = compile(text).unwrap(); in test_if_endif() localVariable
495 assert_eq!(2, instructions.len()); in test_if_endif()
498 &instructions[0] in test_if_endif()
500 assert_eq!(&Literal("Hello!"), &instructions[1]); in test_if_endif()
506 let instructions = compile(text).unwrap(); in test_if_not_endif() localVariable
507 assert_eq!(2, instructions.len()); in test_if_not_endif()
510 &instructions[0] in test_if_not_endif()
512 assert_eq!(&Literal("Hello!"), &instructions[1]); in test_if_not_endif()
518 let instructions = compile(text).unwrap(); in test_if_else_endif() localVariable
519 assert_eq!(4, instructions.len()); in test_if_else_endif()
522 &instructions[0] in test_if_else_endif()
524 assert_eq!(&Literal("Hello!"), &instructions[1]); in test_if_else_endif()
525 assert_eq!(&Goto(4), &instructions[2]); in test_if_else_endif()
526 assert_eq!(&Literal("Goodbye!"), &instructions[3]); in test_if_else_endif()
532 let instructions = compile(text).unwrap(); in test_with() localVariable
533 assert_eq!(3, instructions.len()); in test_with()
536 &instructions[0] in test_with()
538 assert_eq!(&Literal("Hello!"), &instructions[1]); in test_with()
539 assert_eq!(&PopContext, &instructions[2]); in test_with()
545 let instructions = compile(text).unwrap(); in test_foreach() localVariable
546 assert_eq!(5, instructions.len()); in test_foreach()
549 &instructions[0] in test_foreach()
551 assert_eq!(&Iterate(4), &instructions[1]); in test_foreach()
552 assert_eq!(&Value(vec![PathStep::Name("foo")]), &instructions[2]); in test_foreach()
553 assert_eq!(&Goto(1), &instructions[3]); in test_foreach()
554 assert_eq!(&PopContext, &instructions[4]); in test_foreach()
560 let instructions = compile(text).unwrap(); in test_strip_whitespace_value() localVariable
561 assert_eq!(3, instructions.len()); in test_strip_whitespace_value()
562 assert_eq!(&Literal("Hello,"), &instructions[0]); in test_strip_whitespace_value()
563 assert_eq!(&Value(vec![PathStep::Name("name")]), &instructions[1]); in test_strip_whitespace_value()
564 assert_eq!(&Literal(", how are you?"), &instructions[2]); in test_strip_whitespace_value()
570 let instructions = compile(text).unwrap(); in test_strip_whitespace_block() localVariable
571 assert_eq!(6, instructions.len()); in test_strip_whitespace_block()
572 assert_eq!(&Literal("Hello,"), &instructions[0]); in test_strip_whitespace_block()
575 &instructions[1] in test_strip_whitespace_block()
577 assert_eq!(&Literal(""), &instructions[2]); in test_strip_whitespace_block()
578 assert_eq!(&Value(vec![PathStep::Name("name")]), &instructions[3]); in test_strip_whitespace_block()
579 assert_eq!(&Literal(""), &instructions[4]); in test_strip_whitespace_block()
580 assert_eq!(&Literal(", how are you?"), &instructions[5]); in test_strip_whitespace_block()
586 let instructions = compile(text).unwrap(); in test_comment() localVariable
587 assert_eq!(2, instructions.len()); in test_comment()
588 assert_eq!(&Literal("Hello, "), &instructions[0]); in test_comment()
589 assert_eq!(&Literal(" there!"), &instructions[1]); in test_comment()
595 let instructions = compile(text).unwrap(); in test_strip_whitespace_comment() localVariable
596 assert_eq!(2, instructions.len()); in test_strip_whitespace_comment()
597 assert_eq!(&Literal("Hello,"), &instructions[0]); in test_strip_whitespace_comment()
598 assert_eq!(&Literal("there!"), &instructions[1]); in test_strip_whitespace_comment()
604 let instructions = compile(text).unwrap(); in test_strip_whitespace_followed_by_another_tag() localVariable
605 assert_eq!(3, instructions.len()); in test_strip_whitespace_followed_by_another_tag()
606 assert_eq!(&Value(vec![PathStep::Name("value")]), &instructions[0]); in test_strip_whitespace_followed_by_another_tag()
607 assert_eq!(&Value(vec![PathStep::Name("value")]), &instructions[1]); in test_strip_whitespace_followed_by_another_tag()
608 assert_eq!(&Literal(" Hello"), &instructions[2]); in test_strip_whitespace_followed_by_another_tag()
614 let instructions = compile(text).unwrap(); in test_call() localVariable
615 assert_eq!(1, instructions.len()); in test_call()
621 &instructions[0] in test_call()
628 let instructions = compile(text).unwrap(); in test_curly_brace_escaping() localVariable
629 assert_eq!(4, instructions.len()); in test_curly_brace_escaping()
630 assert_eq!(&Literal("body "), &instructions[0]); in test_curly_brace_escaping()
631 assert_eq!(&Literal("{ \nfont-size: "), &instructions[1]); in test_curly_brace_escaping()
632 assert_eq!(&Value(vec![PathStep::Name("fontsize")]), &instructions[2]); in test_curly_brace_escaping()
633 assert_eq!(&Literal(" \n}"), &instructions[3]); in test_curly_brace_escaping()
693 let instructions = compile(text).unwrap(); in test_parse_escaped_open_curly_brace() localVariable
694 assert_eq!(2, instructions.len()); in test_parse_escaped_open_curly_brace()
695 assert_eq!(&Literal("hello "), &instructions[0]); in test_parse_escaped_open_curly_brace()
696 assert_eq!(&Literal("{world}"), &instructions[1]); in test_parse_escaped_open_curly_brace()