182 if not has_subfile_after_invertnext(index): |
182 if not has_subfile_after_invertnext(index): |
183 yield report_problem('bfc-invertnext-not-on-subfile', |
183 yield report_problem('bfc-invertnext-not-on-subfile', |
184 bad_object = model.body[index], |
184 bad_object = model.body[index], |
185 ) |
185 ) |
186 |
186 |
|
187 @problem_type('unknown-metacommand', |
|
188 severity = 'hold', |
|
189 message = lambda command_text: str.format( |
|
190 'unknown or deprecated metacommand: {command_text}', |
|
191 command_text = command_text, |
|
192 ) |
|
193 ) |
|
194 def metacommands_test(model): |
|
195 allowed_metacommand_patterns = [ |
|
196 r'^BFC (CLIP|NOCLIP|INVERTNEXT)$', |
|
197 r'^\!TEXMAP (START|NEXT) .+', |
|
198 r'^\!: .+', |
|
199 r'^\!TEXMAP (FALLBACK|END)$', |
|
200 ] |
|
201 import re |
|
202 for element in model.body[model.header_size:]: |
|
203 if isinstance(element, linetypes.MetaCommand): |
|
204 if element.text and not any( |
|
205 re.match(pattern, element.text) |
|
206 for pattern in allowed_metacommand_patterns |
|
207 ): |
|
208 yield report_problem('unknown-metacommand', |
|
209 bad_object = element, |
|
210 command_text = element.text, |
|
211 ) |
|
212 |
187 manifest = { |
213 manifest = { |
188 'tests': [ |
214 'tests': [ |
189 colours_test, |
215 colours_test, |
190 syntax_errors, |
216 syntax_errors, |
191 bad_header, |
217 bad_header, |