inFixedForm_{that.inFixedForm_},
fixedFormColumnLimit_{that.fixedFormColumnLimit_},
encoding_{that.encoding_}, prescannerNesting_{that.prescannerNesting_ + 1},
+ skipLeadingAmpersand_{that.skipLeadingAmpersand_},
compilerDirectiveBloomFilter_{that.compilerDirectiveBloomFilter_},
compilerDirectiveSentinels_{that.compilerDirectiveSentinels_} {}
BeginSourceLineAndAdvance();
if (inFixedForm_) {
LabelField(tokens);
+ } else if (skipLeadingAmpersand_) {
+ skipLeadingAmpersand_ = false;
+ const char *p{SkipWhiteSpace(at_)};
+ if (p < limit_ && *p == '&') {
+ column_ += ++p - at_;
+ at_ = p;
+ }
} else {
SkipSpaces();
}
if (lineStart_ >= limit_) {
if (afterAmpersand && prescannerNesting_ > 0) {
// A continuation marker at the end of the last line in an
- // include file inhibits the newline.
+ // include file inhibits the newline for that line.
SkipToEndOfLine();
omitNewline_ = true;
}
lineClass.kind == LineClassification::Kind::IncludeLine)) {
SkipToEndOfLine();
omitNewline_ = true;
+ skipLeadingAmpersand_ = true;
return false;
} else {
return false;
if (ampersand) {
p = SkipWhiteSpace(p + 1);
}
- if (*p != '\n' && (inCharLiteral_ || *p != '!')) {
- return false;
+ if (*p != '\n') {
+ if (inCharLiteral_) {
+ return false;
+ } else if (*p != '!') {
+ Say(GetProvenance(p), "treated as comment after &"_en_US);
+ }
}
do {
if (const char *cont{FreeFormContinuationLine(ampersand)}) {
// the line before. Also used when the & appears at the end of the last
// line in an include file.
bool omitNewline_{false};
+ bool skipLeadingAmpersand_{false};
const Provenance spaceProvenance_{
cooked_.allSources().CompilerInsertionProvenance(' ')};
return {};
}
if (driver.dumpCookedChars) {
+ parsing.messages().Emit(std::cerr, parsing.cooked());
parsing.DumpCookedChars(std::cout);
return {};
}
}
// TODO: Change this predicate to just "if (!driver.debugNoSemantics)"
if (driver.debugSemantics || driver.debugResolveNames || driver.dumpSymbols ||
- driver.dumpUnparseWithSymbols ||
- driver.debugLinearFIR || driver.dumpGraph) {
+ driver.dumpUnparseWithSymbols || driver.debugLinearFIR ||
+ driver.dumpGraph) {
Fortran::semantics::Semantics semantics{
semanticsContext, parseTree, parsing.cooked()};
semantics.Perform();