mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-18 00:05:08 +00:00
Accept horizontal tabs around PJL language separator
This commit is contained in:
1 parent
1b7ab973fa
commit
20baec266a
1 file changed
+6
-1
@@ -123,7 +123,7 @@ impl<'a> Lexer<'a> {
|
||||
if let Some((command, language)) = line.split_once("LANGUAGE")
|
||||
&& command.split_ascii_whitespace().eq(["@PJL", "ENTER"])
|
||||
{
|
||||
let lang = language.trim_start_matches([' ', '=']).trim();
|
||||
let lang = language.trim_start_matches([' ', '\t', '=']).trim();
|
||||
self.mode = if lang.starts_with("HPGL") { Mode::Hpgl } else { Mode::Pcl };
|
||||
}
|
||||
self.at += end;
|
||||
@@ -444,6 +444,11 @@ mod tests {
|
||||
assert_eq!(Lexer::new(b"\x1b%-12345X@pjl\tenter\tlanguage=HPGL2\r\nIN;").op(true), Some(*b"IN"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pjl_language_separator_accepts_horizontal_tabs() {
|
||||
assert_eq!(Lexer::new(b"\x1b%-12345X@PJL ENTER LANGUAGE\t=\tHPGL2\nIN;").op(true), Some(*b"IN"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn framing_labels_and_bounded_numbers() {
|
||||
let mut lex = Lexer::new(b"\x1b%-12345X@PJL ENTER LANGUAGE=HPGL2\nIN;LBPU999;\x03PA1,2,3,4;SP2;");
|
||||
|
||||
Reference in new issue
Block a user