[flang] Fix preprocessor tokenization of .NE. style operators.

Original-commit: flang-compiler/f18@ab547b89e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2018-05-02 16:38:31 -07:00
parent bdd68813ca
commit f9941a20b7
3 changed files with 6 additions and 5 deletions

View File

@ -2755,9 +2755,10 @@ TYPE_PARSER(construct<format::FormatItem>(
// R1302 format-specification ->
// ( [format-items] ) | ( [format-items ,] unlimited-format-item )
// R1305 unlimited-format-item -> * ( format-items )
TYPE_PARSER(parenthesized(
construct<format::FormatSpecification>(
defaulted(formatItems / ","), "*" >> parenthesized(formatItems)) ||
// minor extension: the comma is optional before the unlimited-format-item
TYPE_PARSER(parenthesized(construct<format::FormatSpecification>(
defaulted(formatItems / maybe(","_tok)),
"*" >> parenthesized(formatItems)) ||
construct<format::FormatSpecification>(defaulted(formatItems))))
// R1308 w -> digit-string
// R1309 m -> digit-string

View File

@ -720,7 +720,7 @@ static std::int64_t ExpressionValue(const TokenSequence &token,
14, 14, // unary +, -
13, 12, 12, 12, 11, 11, 10, 10, // **, *, /, %, +, -, <<, >>
9, 8, 7, // &, ^, |
6, 6, 6, 6, 6, 6, // relations
6, 6, 6, 6, 6, 6, // relations .LT. to .GT.
5, 4, 3, 2, 2, // .NOT., .AND., .OR., .EQV., .NEQV.
1, 0 // ?: and ,
};

View File

@ -344,7 +344,7 @@ bool Prescanner::NextToken(TokenSequence *tokens) {
preventHollerith_ = false;
} else if (*at_ == '.') {
char nch{EmitCharAndAdvance(tokens, '.')};
if (IsDecimalDigit(nch)) {
if (!inPreprocessorDirective_ && IsDecimalDigit(nch)) {
while (IsDecimalDigit(EmitCharAndAdvance(tokens, *at_))) {
}
ExponentAndKind(tokens);