================
Comment at: lib/ASTMatchers/Dynamic/Parser.cpp:97-98
@@ +96,4 @@
+      size_t TokenLength = 0;
+      while (TokenLength < Code.size() && isAlphanumeric(Code[TokenLength]))
+        ++TokenLength;
+      Result.Kind = TokenInfo::TK_IDENT;
----------------
Samuel Benzaquen wrote:
> Dmitri Gribenko wrote:
> > What if this loop executes 0 times?  This should be an error.
> Fixed. Added an 'invalid' token kind.
IMHO it would be better to just emit an error (and mark that the resulting AST 
is invalid), skip the bad character.  This also naturally enables recovery.  
Otherwise, you will have to consider invalid tokens everywhere in the parser.

================
Comment at: lib/ASTMatchers/Dynamic/Parser.cpp:254
@@ +253,3 @@
+/// parse function.
+bool Parser::parseNextToken(VariantValue *Value) {
+  const TokenInfo Token = Tokenizer->consumeNextToken();
----------------
Now the name of this function is completely bogus.

Please consider restructuring the parser so that the names of the functions 
reflect the productions in the grammar.

For example, this function should be probably called parseExpression().


http://llvm-reviews.chandlerc.com/D714

BRANCH
  svn

ARCANIST PROJECT
  clang
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to