[flang] Preserve some minor changes that accumulated as I was implementing
an unparsing feature.
Enum classes in parse tree node class types are now defined with
a macro so that the names of the enumerations can be captured for
formatting purposes.
Add a TODO comment.
Rebase to new master with parse tree traversal code.
Original-commit: flang-compiler/f18@d6bfcfd526cc8464046e855181b7771631793313
Reviewed-on: https://github.com/flang-compiler/f18/pull/16
diff --git a/flang/lib/parser/prescan.h b/flang/lib/parser/prescan.h
index 50198f0..8782f9d 100644
--- a/flang/lib/parser/prescan.h
+++ b/flang/lib/parser/prescan.h
@@ -74,6 +74,17 @@
tokens->PutNextTokenChar(ch, GetCurrentProvenance());
}
+ void EmitInsertedChar(TokenSequence *tokens, char ch) {
+ Provenance provenance{
+ cooked_->allSources()->CompilerInsertionProvenance(ch)};
+ tokens->PutNextTokenChar(ch, provenance);
+ }
+
+ void EmitEscapedChar(TokenSequence *tokens, char ch) {
+ EmitInsertedChar(tokens, '\\');
+ EmitChar(tokens, ch);
+ }
+
char EmitCharAndAdvance(TokenSequence *tokens, char ch) {
EmitChar(tokens, ch);
NextChar();
@@ -86,8 +97,9 @@
void SkipSpaces();
bool NextToken(TokenSequence *);
bool ExponentAndKind(TokenSequence *);
+ void EmitQuotedCharacter(TokenSequence *, char);
void QuotedCharacterLiteral(TokenSequence *);
- bool PadOutCharacterLiteral();
+ bool PadOutCharacterLiteral(TokenSequence *);
bool CommentLines();
bool CommentLinesAndPreprocessorDirectives();
bool IsFixedFormCommentLine(const char *);
@@ -123,6 +135,8 @@
int delimiterNesting_{0};
Provenance spaceProvenance_{
cooked_->allSources()->CompilerInsertionProvenance(' ')};
+ Provenance backslashProvenance_{
+ cooked_->allSources()->CompilerInsertionProvenance('\\')};
};
} // namespace parser
} // namespace Fortran