deny exponents over 2 digits

this is done in order to avoid hangs on small inputs.
This commit is contained in:
Connor Skees 2020-06-28 07:02:12 -04:00
parent c7608fce4e
commit 8622efc7be

View File

@ -100,6 +100,8 @@ pub(crate) fn eat_number<I: Iterator<Item = Token>>(
if times_ten.is_empty() && !times_ten_is_postive { if times_ten.is_empty() && !times_ten_is_postive {
return Err(("Expected digit.", toks.peek().unwrap_or(&t).pos).into()); return Err(("Expected digit.", toks.peek().unwrap_or(&t).pos).into());
} else if times_ten.len() > 2 {
return Err(("Exponent too large.", toks.peek().unwrap_or(&t).pos).into());
} }
} }
break; break;