@@ -957,18 +957,21 @@ static int parse_reg_from_string(const QString &str, uint *chars_taken = nullptr
957
957
const QString allowed_special_chars = QStringLiteral(" _+-/*|&^~" );
958
958
959
959
/* * Takes largest sequence of valid relocation expression chars and removes whitespaces */
960
- static QString read_reloc_expression (const QString &input) {
960
+ static std::pair< QString, uint32_t > read_reloc_expression (const QString &input) {
961
961
QString expression;
962
+ uint32_t chars_taken = 0 ;
962
963
for (QChar ch : input) {
963
964
if (ch.isLetterOrNumber () || allowed_special_chars.contains (ch)) {
964
965
expression.append (ch);
966
+ chars_taken += 1 ;
965
967
} else if (ch.isSpace ()) {
968
+ chars_taken += 1 ;
966
969
continue ;
967
970
} else {
968
971
break ;
969
972
}
970
973
}
971
- return expression;
974
+ return { expression, chars_taken } ;
972
975
}
973
976
974
977
static void reloc_append (
@@ -981,14 +984,14 @@ static void reloc_append(
981
984
const QString &filename = " " ,
982
985
int line = 0 ,
983
986
Instruction::Modifier pseudo_mod = machine::Instruction::Modifier::NONE) {
984
- QString expression = read_reloc_expression (fl);
987
+ auto [ expression, chars_taken_] = read_reloc_expression (fl);
985
988
if (expression.size () > 0 ) {
986
989
// Do not append empty relocation expressions
987
990
reloc->append (new RelocExpression (
988
991
inst_addr, expression, offset, adesc->min , adesc->max , &adesc->arg , filename, line,
989
992
pseudo_mod));
990
993
}
991
- if (chars_taken != nullptr ) { *chars_taken = expression. size () ; }
994
+ if (chars_taken != nullptr ) { *chars_taken = chars_taken_ ; }
992
995
}
993
996
994
997
size_t Instruction::code_from_tokens (
0 commit comments