Skip to content

Commit

Permalink
Allow extended gcode names with leading underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
dalegaard committed Aug 31, 2022
1 parent 29afa82 commit 8997799
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/src/gcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,17 @@ mod parser {
use super::*;
use nom::{
branch::alt,
bytes::complete::{tag, tag_no_case, take_till, take_until, take_while},
bytes::complete::{tag, tag_no_case, take_till, take_until, take_while, take_while1},
character::complete::{char, satisfy, space0, space1},
combinator::{complete, eof, map, opt, recognize},
combinator::{complete, eof, map, opt},
error::{Error, ErrorKind, ParseError},
multi::separated_list0,
sequence::tuple,
Err, IResult, Parser, Slice,
};
use std::borrow::Cow;

#[derive(Debug)]
#[derive(Debug, Eq, PartialEq)]
pub struct GCodeParseError {
position: String,
}
Expand Down Expand Up @@ -389,10 +389,7 @@ mod parser {
}

fn extended_name(s: &str) -> IResult<&str, &str> {
recognize(tuple((
satisfy(|c| c.is_alphabetic()),
take_while(|c: char| c.is_alphanumeric() || c == '_'),
)))(s)
take_while1(|c: char| c.is_alphabetic() || c == '_')(s)
}

fn extended_param(s: &str) -> IResult<&str, (&str, Cow<str>)> {
Expand Down

0 comments on commit 8997799

Please sign in to comment.