github.com/cmaughan/aoc...
This sort of thing
let mut tokens = Vec::new();
while self.position < self.input.len() {
let c = self.input[self.position..].chars().next().unwrap();
if c.is_whitespace() {
self.position += c.len_utf8();
github.com/cmaughan/aoc...
This sort of thing
let mut tokens = Vec::new();
while self.position < self.input.len() {
let c = self.input[self.position..].chars().next().unwrap();
if c.is_whitespace() {
self.position += c.len_utf8();
I would keep track of the state you are in.
Start in state=0,
Parse mul( and you are now in state 1
If you see a number, and you are in state 1 then ....
I would keep track of the state you are in.
Start in state=0,
Parse mul( and you are now in state 1
If you see a number, and you are in state 1 then ....