Hi Harald,
This introduces the helper function gfc_match_next_char, which is your second option.
I would be a little bit concerned about compilation times with the additional function call overhead. The function is used only in one place; would it make sense to put it into primary.cc and declare it static? Best regards Thomas