Debian Codegraph @

src/lex.rs

raw symbols SCIP
1 use craterust-analyzer cargo makefile-lossless 0.3.40 crate/::SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::Peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/Peekable#;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::Charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/Chars#;
4
5 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
6 enum LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType# {
7 Reciperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Recipe#,
8 Otherrust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Other#,
9 }
10
11 pub struct Lexerrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#<'a> {
12 inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input.: Peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/Peekable#<Charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/Chars#<'a>>,
13 line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#>,
14 continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#continuation.: bool,
15 /// Parity of the current backslash run: true once an odd number have been
16 /// emitted, so the next backslash is escaped (`\\`) and a following newline
17 /// is literal, not a continuation. Mirrors the parser's
18 /// `pending_backslash_escape`.
19 pending_backslash_escaperust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#pending_backslash_escape.: bool,
20 }
21
22 impl<'a> Lexerrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#<'a> {
23 pub fn newrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]new().(input: &'a str) -> Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`] {
24 Lexerrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer# {
25 inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input.: input.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#peekable().(),
26 continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#continuation.: false,
27 line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
28 pending_backslash_escaperust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#pending_backslash_escape.: false,
29 }
30 }
31
32 fn is_whitespacerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_whitespace().(c: char) -> bool {
33 c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().' ' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\t'
34 }
35
36 fn is_newlinerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_newline().(c: char) -> bool {
37 c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\n' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\r'
38 }
39
40 fn is_valid_identifier_charrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_valid_identifier_char().(c: char) -> bool {
41 c.is_ascii_alphabeticrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_ascii_alphabetic().()
42 || c.is_ascii_digitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_ascii_digit().()
43 || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'_'
44 || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'/'
45 || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'.'
46 || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'-'
47 || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'%'
48 }
49
50 /// Check whether a matching close-quote appears on the current line.
51 /// Make doesn't treat quotes as syntactic; we only group them so that
52 /// embedded parens don't confuse $(...) parsing. If the quote is
53 /// unterminated (or asymmetric, like `it's`), grouping would do more
54 /// harm than good — so we only group when there's a partner on the
55 /// same line. A backslash escapes the next character.
56 fn has_matching_close_quoterust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]has_matching_close_quote().(&self, quote: char) -> bool {
57 let mut probe = self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Clone]clone().();
58 probe.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().(); // Skip the opening quote we already peeked.
59 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) = probe.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().() {
60 if Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_newlinerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_newline().(c) {
61 return false;
62 }
63 if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\\' {
64 probe.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
65 continue;
66 }
67 if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().quote {
68 return true;
69 }
70 }
71 false
72 }
73
74 fn read_quoted_stringrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_quoted_string().(&mut self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
75 let mut result = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
76 let quote = self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); // Consume opening quote
77 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(quote);
78
79 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&c) = self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().() {
80 if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().quote {
81 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c);
82 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
83 break;
84 } else if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\\' {
85 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c);
86 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().(); // Consume backslash
87 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next) = self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().() {
88 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(next);
89 }
90 } else {
91 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c);
92 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
93 }
94 }
95 result
96 }
97
98 fn read_whilerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_while().<F>(&mut self, predicate: F) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#
99 where
100 F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(char) -> bool,
101 {
102 let mut result = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
103 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&c) = self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().() {
104 if predicate(c) {
105 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c);
106 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
107 } else {
108 break;
109 }
110 }
111 result
112 }
113
114 fn next_tokenrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]next_token().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)> {
115 // A backslash continues the line only when it is not itself escaped by
116 // a preceding backslash. `escaped` is the run parity carried over from
117 // the previous token; clear the field here so any non-backslash token
118 // resets the run.
119 let escaped = self.pending_backslash_escaperust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#pending_backslash_escape.;
120 self.pending_backslash_escaperust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#pending_backslash_escape. = false;
121 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&c) = self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().() {
122 match (c, self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type.) {
123 ('\t', Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#continuation. => {
124 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
125 self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#::Reciperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Recipe#);
126 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::INDENTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#INDENT#, "\t".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
127 }
128 ('\t', Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => {
129 // Continuation line: tab is indent but not a recipe
130 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
131 self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#::Otherrust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Other#);
132 self.continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#continuation. = false;
133 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::INDENTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#INDENT#, "\t".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
134 }
135 (' ', Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#continuation. => {
136 // Check if this is the start of a space-indented recipe (2 or 4 spaces)
137 let spaces = self.read_whilerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_while().(|ch| ch rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().' ');
138 if spaces.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().2 {
139 self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#::Reciperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Recipe#);
140 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::INDENTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#INDENT#, spaces));
141 } else {
142 // If just a single space, treat as normal whitespace
143 self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#::Otherrust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Other#);
144 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, spaces));
145 }
146 }
147 (' ', Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => {
148 // Continuation line: spaces are indent but not a recipe
149 let spaces = self.read_whilerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_while().(|ch| ch rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().' ');
150 self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#::Otherrust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Other#);
151 self.continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#continuation. = false;
152 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::INDENTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#INDENT#, spaces));
153 }
154 (_, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => {
155 self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#::Otherrust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Other#);
156 self.continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#continuation. = false;
157 }
158 (_, _) => {}
159 }
160
161 match c {
162 c if Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_newlinerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_newline().(c) => {
163 self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
164 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
165 }
166 '#' => {
167 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((
168 SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::COMMENTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#COMMENT#,
169 self.read_whilerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_while().(|c| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_newlinerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_newline().(c)),
170 ));
171 }
172 _ => {}
173 }
174
175 match self.line_typerust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#line_type..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() {
176 LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#::Reciperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Recipe# => {
177 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::TEXTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#TEXT#, self.read_whilerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_while().(|c| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_newlinerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_newline().(c))))
178 }
179 LineTyperust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#::Otherrust-analyzer cargo makefile-lossless 0.3.40 lex/LineType#Other# => match c {
180 c if Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_whitespacerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_whitespace().(c) => {
181 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, self.read_whilerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_while().(Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_whitespacerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_whitespace().)))
182 }
183 c if Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_valid_identifier_charrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_valid_identifier_char().(c) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((
184 SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#,
185 self.read_whilerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_while().(Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_valid_identifier_charrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_valid_identifier_char().),
186 )),
187 '"' | '\'' => {
188 if self.has_matching_close_quoterust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]has_matching_close_quote().(c) {
189 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::QUOTErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#QUOTE#, self.read_quoted_stringrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_quoted_string().()))
190 } else {
191 // Lone quote — emit as a single-character QUOTE
192 // token so paren counting in $(...) still works.
193 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
194 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::QUOTErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#QUOTE#, c.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
195 }
196 }
197 ':' | '=' | '?' | '+' => {
198 let text = self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
199 +rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().self
200 .read_whilerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]read_while().(|c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().':' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'=' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'?')
201 .as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().();
202 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, text))
203 }
204 '(' => {
205 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
206 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::LPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#LPAREN#, "(".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
207 }
208 ')' => {
209 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
210 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::RPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#RPAREN#, ")".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
211 }
212 '{' => {
213 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
214 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::LBRACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#LBRACE#, "{".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
215 }
216 '}' => {
217 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
218 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::RBRACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#RBRACE#, "}".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
219 }
220 '$' => {
221 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
222 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::DOLLARrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#DOLLAR#, "$".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
223 }
224 ',' => {
225 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
226 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::COMMArust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#COMMA#, ",".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
227 }
228 '\\' => {
229 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
230 // A backslash-newline is a continuation only if this
231 // backslash is not escaped by a preceding one.
232 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().escaped && self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().().is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|&c| Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]::is_newlinerust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]is_newline().(c)) {
233 self.continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#continuation. = true;
234 }
235 self.pending_backslash_escaperust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#pending_backslash_escape. = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().escaped;
236 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::BACKSLASHrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#BACKSLASH#, "\\".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
237 }
238 _ => {
239 self.inputrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#input..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
240 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::ERRORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#ERROR#, c.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
241 }
242 },
243 }
244 } else {
245 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
246 }
247 }
248 }
249
250 impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Lexerrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#<'_> {
251 type Itemrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'_>`][Iterator]Item# = (craterust-analyzer cargo makefile-lossless 0.3.40 crate/::SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
252
253 fn nextrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'_>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'_>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
254 self.next_tokenrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]next_token().()
255 }
256 }
257
258 pub(craterust-analyzer cargo makefile-lossless 0.3.40 crate/) fn lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(input: &str) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)> {
259 Lexerrust-analyzer cargo makefile-lossless 0.3.40 lex/Lexer#::newrust-analyzer cargo makefile-lossless 0.3.40 lex/impl#[`Lexer<'a>`]new().(input).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
260 }
261
262 #[cfg(test)]
263 mod testsrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/ {
264 use superrust-analyzer cargo makefile-lossless 0.3.40 lex/::*;
265
266 use craterust-analyzer cargo makefile-lossless 0.3.40 crate/::SyntaxKindrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#::*;
267
268 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
269 fn test_emptyrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_empty().() {
270 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(""), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
271 }
272
273 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
274 fn test_simplerust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_simple().() {
275 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
276 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(r#"VARIABLE = value
277
278 rule: prerequisite
279 recipe
280 "#)
281 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
282 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
283 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
284 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
285 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "VARIABLE"),
286 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
287 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, "="),
288 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
289 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "value"),
290 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
291 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
292 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "rule"),
293 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, ":"),
294 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
295 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "prerequisite"),
296 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
297 (INDENTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#INDENT#, "\t"),
298 (TEXTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#TEXT#, "recipe"),
299 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
300 ]
301 );
302 }
303
304 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
305 fn test_bare_exportrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_bare_export().() {
306 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
307 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(r#"export
308 "#)
309 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
310 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
311 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
312 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "export"), (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),]
313 );
314 }
315
316 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
317 fn test_exportrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_export().() {
318 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
319 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(r#"export VARIABLE
320 "#)
321 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
322 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
323 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
324 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
325 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "export"),
326 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
327 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "VARIABLE"),
328 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
329 ]
330 );
331 }
332
333 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
334 fn test_export_assignmentrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_export_assignment().() {
335 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
336 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(r#"export VARIABLE := value
337 "#)
338 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
339 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
340 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
341 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
342 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "export"),
343 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
344 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "VARIABLE"),
345 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
346 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, ":="),
347 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
348 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "value"),
349 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
350 ]
351 );
352 }
353
354 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
355 fn test_multiple_prerequisitesrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_multiple_prerequisites().() {
356 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
357 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(r#"rule: prerequisite1 prerequisite2
358 recipe
359
360 "#)
361 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
362 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
363 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
364 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
365 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "rule"),
366 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, ":"),
367 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
368 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "prerequisite1"),
369 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
370 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "prerequisite2"),
371 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
372 (INDENTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#INDENT#, "\t"),
373 (TEXTrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#TEXT#, "recipe"),
374 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
375 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
376 ]
377 );
378 }
379
380 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
381 fn test_variable_questionrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_variable_question().() {
382 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
383 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().("VARIABLE ?= value\n")
384 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
385 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
386 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
387 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
388 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "VARIABLE"),
389 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
390 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, "?="),
391 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
392 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "value"),
393 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
394 ]
395 );
396 }
397
398 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
399 fn test_conditionalrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_conditional().() {
400 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
401 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(r#"ifneq (a, b)
402 endif
403 "#)
404 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
405 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
406 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
407 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
408 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "ifneq"),
409 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
410 (LPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#LPAREN#, "("),
411 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "a"),
412 (COMMArust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#COMMA#, ","),
413 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
414 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "b"),
415 (RPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#RPAREN#, ")"),
416 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
417 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "endif"),
418 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
419 ]
420 );
421 }
422
423 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
424 fn test_variable_parenrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_variable_paren().() {
425 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
426 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().("VARIABLE = $(value)\n")
427 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
428 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
429 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
430 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
431 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "VARIABLE"),
432 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
433 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, "="),
434 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
435 (DOLLARrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#DOLLAR#, "$"),
436 (LPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#LPAREN#, "("),
437 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "value"),
438 (RPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#RPAREN#, ")"),
439 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
440 ]
441 );
442 }
443
444 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
445 fn test_variable_paren2rust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_variable_paren2().() {
446 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
447 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().("VARIABLE = $(value)$(value2)\n")
448 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
449 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
450 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
451 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
452 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "VARIABLE"),
453 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
454 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, "="),
455 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
456 (DOLLARrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#DOLLAR#, "$"),
457 (LPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#LPAREN#, "("),
458 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "value"),
459 (RPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#RPAREN#, ")"),
460 (DOLLARrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#DOLLAR#, "$"),
461 (LPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#LPAREN#, "("),
462 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "value2"),
463 (RPARENrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#RPAREN#, ")"),
464 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
465 ]
466 );
467 }
468
469 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
470 fn test_oomrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_oom().() {
471 let text = r#"
472 #!/usr/bin/make -f
473 #
474 # debhelper-7 [debian/rules] for cups-pdf
475 #
476 # COPYRIGHT © 2003-2021 Martin-Éric Racine <[email protected]>
477 #
478 # LICENSE
479 # GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
480 #
481 export CC := $(shell dpkg-architecture --query DEB_HOST_GNU_TYPE)-gcc
482 export CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
483 export CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
484 export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
485 #export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-bindnow,-pie
486 # Append flags for Long File Support (LFS)
487 # LFS_CPPFLAGS does not exist
488 export DEB_CFLAGS_MAINT_APPEND +=$(shell getconf LFS_CFLAGS) $(HARDENING_CFLAGS)
489 export DEB_LDFLAGS_MAINT_APPEND +=$(shell getconf LFS_LDFLAGS) $(HARDENING_LDFLAGS)
490
491 override_dh_auto_build-arch:
492 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o src/cups-pdf src/cups-pdf.c -lcups
493
494 override_dh_auto_clean:
495 rm -f src/cups-pdf src/*.o
496
497 %:
498 dh $@
499 #EOF
500 "#;
501
502 let _lexed = lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(text);
503 }
504
505 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
506 fn test_pattern_rulerust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_pattern_rule().() {
507 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
508 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().("%.o: %.c\n")
509 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
510 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
511 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
512 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
513 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "%.o"),
514 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, ":"),
515 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
516 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "%.c"),
517 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
518 ]
519 );
520 }
521
522 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
523 fn test_include_directiverust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_include_directive().() {
524 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
525 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().("-include .env\n")
526 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
527 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
528 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
529 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
530 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "-include"),
531 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
532 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, ".env"),
533 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
534 ]
535 );
536 }
537
538 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
539 fn test_slash_in_identifierrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_slash_in_identifier().() {
540 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
541 lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().("usr/bin/foo: src/main.o\n")
542 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
543 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kind, text)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind, text.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()))
544 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
545 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
546 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "usr/bin/foo"),
547 (OPERATORrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#OPERATOR#, ":"),
548 (WHITESPACErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#WHITESPACE#, " "),
549 (IDENTIFIERrust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#IDENTIFIER#, "src/main.o"),
550 (NEWLINErust-analyzer cargo makefile-lossless 0.3.40 SyntaxKind#NEWLINE#, "\n"),
551 ]
552 );
553 }
554
555 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
556 fn test_backslash_in_variable_continuationrust-analyzer cargo makefile-lossless 0.3.40 lex/tests/test_backslash_in_variable_continuation().() {
557 let input = "VAR ?= $(shell cmd | \\\n\t\tsed -rne 's,^V: ([^-]+).*,\\1,p')\n";
558 let tokens = lexrust-analyzer cargo makefile-lossless 0.3.40 lex/lex().(input);
559 // Check that the backslash before '1' is preserved
560 let text: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = tokens.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(_, t)| t.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
561 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(input, text, "Token text reconstruction differs from input");
562 }
563 }