From dba769e13ca5029643c6068e53fa34ae0fea8421 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Fri, 28 Feb 2025 13:23:20 +1300 Subject: Implement string literals String literals are treated as integers. If a string is passed as an integer argument to a packed binary literal, a new instance of the packed binary literal is invoked for every character in the string, with each character being passed to the packed binary literal as a Unicode character value. --- src/report.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/report.rs') diff --git a/src/report.rs b/src/report.rs index 2acdddc..a88de4f 100644 --- a/src/report.rs +++ b/src/report.rs @@ -61,8 +61,12 @@ pub fn report_syntactic_errors(syntactic_tokens: &[SyntacticToken], source_code: let message = format!("Unterminated comment"); report_source_error!(&context, &message); } + SyntacticParseError::UnterminatedString => { + let message = format!("Unterminated string"); + report_source_error!(&context, &message); + } SyntacticParseError::UnterminatedExpression => { - let message = format!("Unterminated constant expression"); + let message = format!("Unterminated assembler expression"); report_source_error!(&context, &message); } SyntacticParseError::LabelInMacroDefinition => { @@ -184,6 +188,8 @@ fn report_assembler_error(error: &AssemblerError, source_code: &str) { format!("Value of type integer was expected here"), AssemblerErrorVariant::IntegerInBlock => format!("Integer in block"), + AssemblerErrorVariant::StringInExpression => + format!("Expressions cannot contain strings"), AssemblerErrorVariant::IncorrectArgumentCount(expected, received) => format!("Expected {expected} arguments, but received {received} instead"), AssemblerErrorVariant::IncorrectArgumentType(expected, received) => -- cgit v1.2.3-70-g09d2