Paul C. Anagnostopoulos via llvm-dev
2020-Jul-30 17:00 UTC
[llvm-dev] Suggestion for TableGen ranges
The is a syntax quirk in TableGen. A leading plus or minus sign on a decimal integer is considered part of the integer token. Coupled with this, the hyphen (-) is used to indicate integer ranges, as in '1-5'. But the compiler lexes '1-5' as '1' followed by '-5', so a special rule is required to treat that as a range. It is documented as follows: "The peculiar last form of RangePiece is due to the fact that the "-" is included in the TokInteger, hence 1-5 gets lexed as two consecutive TokInteger�s, with values 1 and -5, instead of "1", "-", and "5"." I propose that we add '..' as a new punctuation token and use it to indicate ranges: 1..5, -10..-5. Then we can deprecate the hyphen range construct.
Nicolai Hähnle via llvm-dev
2020-Aug-04 20:56 UTC
[llvm-dev] Suggestion for TableGen ranges
On Thu, Jul 30, 2020 at 7:04 PM Paul C. Anagnostopoulos via llvm-dev <llvm-dev at lists.llvm.org> wrote:> The is a syntax quirk in TableGen. A leading plus or minus sign on a decimal integer is considered part of the integer token. Coupled with this, the hyphen (-) is used to indicate integer ranges, as in '1-5'. But the compiler lexes '1-5' as '1' followed by '-5', so a special rule is required to treat that as a range. It is documented as follows: > > "The peculiar last form of RangePiece is due to the fact that the "-" is included in the TokInteger, hence 1-5 gets lexed as two consecutive TokInteger’s, with values 1 and -5, instead of "1", "-", and "5"." > > I propose that we add '..' as a new punctuation token and use it to indicate ranges: 1..5, -10..-5. Then we can deprecate the hyphen range construct.I like this proposal. Feel free to ping me if you need a review. Cheers, Nicolai> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte.
Paul C. Anagnostopoulos via llvm-dev
2020-Aug-04 21:00 UTC
[llvm-dev] Suggestion for TableGen ranges
What is the protocol for deciding when a suggestion should actually be implemented? At 8/4/2020 04:56 PM, Nicolai Hähnle wrote:>On Thu, Jul 30, 2020 at 7:04 PM Paul C. Anagnostopoulos via llvm-dev ><llvm-dev at lists.llvm.org> wrote: >> The is a syntax quirk in TableGen. A leading plus or minus sign on a decimal integer is considered part of the integer token. Coupled with this, the hyphen (-) is used to indicate integer ranges, as in '1-5'. But the compiler lexes '1-5' as '1' followed by '-5', so a special rule is required to treat that as a range. It is documented as follows: >> >> "The peculiar last form of RangePiece is due to the fact that the "-" is included in the TokInteger, hence 1-5 gets lexed as two consecutive TokIntegerâs, with values 1 and -5, instead of "1", "-", and "5"." >> >> I propose that we add '..' as a new punctuation token and use it to indicate ranges: 1..5, -10..-5. Then we can deprecate the hyphen range construct. > >I like this proposal. Feel free to ping me if you need a review. > >Cheers, >Nicolai