[PATCH] MIR Parsing: Introduce a MI Lexing class.
Alex Lorenz
arphaman at gmail.com
Thu Jun 18 19:16:31 PDT 2015
REPOSITORY
rL LLVM
================
Comment at: lib/CodeGen/MIRParser/MIParser.cpp:29
@@ -27,3 +28,3 @@
-class MIParser {
+class MIParser : public MILexer {
SourceMgr &SM;
----------------
silvas wrote:
> Is there a reason you chose is-a instead of has-a here? I don't think I've ever seen a parser implemented as a subclass of the lexer.
This was done so that the parser could override the error reporting method in the lexer so that the lexer could report errors. I will remove this, as I can just pass an error handler function to the lexToken method which will be called directly from the parser.
================
Comment at: lib/CodeGen/MIRParser/MIParser.cpp:70
@@ -60,1 +69,3 @@
+
+void MIParser::lex() { MILexer::lex(Token); }
----------------
silvas wrote:
> This lex() function don't seem to be buying you very much. It seems like it might as well just contain a call to a free function equivalent of what is currently the member function MILexer::lexToken. E.g. it could just be `void MIParser::lex() { CurrentSource = lexToken(CurrentSource, Token, ErrorCallback); }`.
Sure, this makes sense. I'll post the updated patch tomorrow.
http://reviews.llvm.org/D10521
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list