luaur_ast/methods/
parser_report_name_error.rs1use crate::records::parser::Parser;
2use luaur_common::macros::luau_noinline::LUAU_NOINLINE;
3
4impl Parser {
5 LUAU_NOINLINE! {
6 pub fn report_name_error(&mut self, context: &str) {
7 let location = self.lexer.current().location;
8 let current_lexeme_string = self.lexer.current().to_string();
9
10 if !context.is_empty() {
11 self.report(
12 location,
13 format_args!(
14 "Expected identifier when parsing {}, got {}",
15 context, current_lexeme_string
16 ),
17 );
18 } else {
19 self.report(
20 location,
21 format_args!("Expected identifier, got {}", current_lexeme_string),
22 );
23 }
24 }
25 }
26}