From: peter klausler Date: Sat, 7 Apr 2018 00:04:18 +0000 (-0700) Subject: [flang] Prevent misrecognition of a digit string that is the kind parameter of a... X-Git-Tag: llvmorg-12-init~9537^2~2752 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de180f4ed0626a42925854ed8ac299264033a1dc;p=platform%2Fupstream%2Fllvm.git [flang] Prevent misrecognition of a digit string that is the kind parameter of a character literal from being misrecognized as an integer literal. Original-commit: flang-compiler/f18@bd7ed0b162b7cc4e89e0d08e22e8676d59261931 Reviewed-on: https://github.com/flang-compiler/f18/pull/48 Tree-same-pre-rewrite: false --- diff --git a/flang/lib/parser/grammar.h b/flang/lib/parser/grammar.h index dcab4fb..07803f4 100644 --- a/flang/lib/parser/grammar.h +++ b/flang/lib/parser/grammar.h @@ -713,8 +713,10 @@ TYPE_PARSER(space >> sourced(construct{}( signedDigitString, maybe(underscore >> kindParam)))) // R708 int-literal-constant -> digit-string [_ kind-param] +// The negated look-ahead for a trailing underscore prevents misrecognition +// when the digit string is a numeric kind parameter of a character literal. TYPE_PARSER(construct{}( - space >> digitString, maybe(underscore >> kindParam))) + space >> digitString, maybe(underscore >> kindParam) / !underscore)) // R709 kind-param -> digit-string | scalar-int-constant-name TYPE_PARSER(construct{}(digitString) ||