}
void Prescanner::LabelField(TokenSequence &token, int outCol) {
+ bool badLabel{false};
for (; *at_ != '\n' && column_ <= 6; ++at_) {
if (*at_ == '\t') {
++at_;
if (*at_ != ' ' &&
!(*at_ == '0' && column_ == 6)) { // '0' in column 6 becomes space
EmitChar(token, *at_);
+ if (!IsDecimalDigit(*at_) && !badLabel) {
+ Say(GetProvenance(at_),
+ "Character in fixed-form label field must be a digit"_en_US);
+ badLabel = true;
+ }
++outCol;
}
++column_;
if (outCol > 1) {
token.CloseToken();
}
- if (outCol < 7) {
- if (outCol == 1) {
- token.Put(" ", 6, sixSpaceProvenance_.start());
- } else {
- for (; outCol < 7; ++outCol) {
- token.PutNextTokenChar(' ', spaceProvenance_);
- }
- token.CloseToken();
- }
- }
SkipToNextSignificantCharacter();
+ if (IsDecimalDigit(*at_)) {
+ Say(GetProvenance(at_),
+ "Label digit is not in fixed-form label field"_en_US);
+ }
}
void Prescanner::SkipToEndOfLine() {
cooked_.allSources().CompilerInsertionProvenance(' ')};
const Provenance backslashProvenance_{
cooked_.allSources().CompilerInsertionProvenance('\\')};
- const ProvenanceRange sixSpaceProvenance_{
- cooked_.allSources().AddCompilerInsertion(" "s)};
// To avoid probing the set of active compiler directive sentinel strings
// on every comment line, they're checked first with a cheap Bloom filter.
--- /dev/null
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: Label digit is not in fixed-form label field
+ 1 continue
+! CHECK: Label digit is not in fixed-form label field
+ 1 2 continue
+! CHECK-NOT: Label is not in fixed-form label field
+ con
+ 3 tinue
+! CHECK: Character in fixed-form label field must be a digit
+end
+! CHECK: 1continue
+! CHECK: 12continue
+! CHECK: continue
+! CHECK: end