summaryrefslogtreecommitdiff
path: root/src/syntax/tokens.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-07-15 23:49:10 +0200
committerLaurenz <laurmaedje@gmail.com>2020-07-15 23:49:10 +0200
commite96f3830f19ed63ae8b43f8ce33f824237b34d82 (patch)
tree62c12d1ff134a1a89dd4565270e9b862e96f8788 /src/syntax/tokens.rs
parent1683ca87f797a6262f0a4f75bde0e23eca31798c (diff)
Use FromStr trait and formatting ✨
Diffstat (limited to 'src/syntax/tokens.rs')
-rw-r--r--src/syntax/tokens.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/syntax/tokens.rs b/src/syntax/tokens.rs
index 07a1ac92..adf29de2 100644
--- a/src/syntax/tokens.rs
+++ b/src/syntax/tokens.rs
@@ -230,7 +230,7 @@ impl<'s> Iterator for Tokens<'s> {
// Expressions or just strings.
c => {
let body = self.mode == Body;
-
+
let text = self.read_string_until(|n| {
match n {
c if c.is_whitespace() => true,
@@ -389,12 +389,10 @@ impl<'s> Tokens<'s> {
fn parse_hex_value(&mut self) -> Token<'s> {
// This will parse more than the permissable 0-9, a-f, A-F character
// ranges to provide nicer error messages later.
- let payload = self.read_string_until(
- |n| !n.is_ascii_alphanumeric(),
+ ExprHex(self.read_string_until(
+ |n| !n.is_ascii_alphanumeric(),
false, 0, 0
- ).0;
-
- ExprHex(payload)
+ ).0)
}
fn parse_expr(&mut self, text: &'s str) -> Token<'s> {