[PATCH] D14252: [AsmParser] Allow tokens to be put back in to the token stream.

Colin LeMahieu via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 10:26:36 PST 2015


colinl added a comment.

With the expression parsing example failing on "+ #" it seemed like the only alternative was to copy/paste the built-in expression parser and modify it to deal with this situation.

Another instance where this was helpful is in HexagonAsmParser::ParseInstruction.  Previously we only got the string for the first token in a statement, this is because usually the first token is a mnemonic string which isn't true here.  An option would be to modify AsmParser and not consume the token but a bunch of the logic around labels, directives, etc assumed the first token was consumed.

A lot of this is because different ASM grammars lex differently, I'm not sure having one lexer/parser for everything is sustainable.  I'm open to ideas.


Repository:
  rL LLVM

http://reviews.llvm.org/D14252





More information about the llvm-commits mailing list