testcase for PR159
[oota-llvm.git] / lib / AsmParser / Lexer.l
index 0a9d2c3e8f9b49762496b54e3bf6547d2f63d046..b0e174af50f930ac632688883efcc2880c1bd638 100644 (file)
@@ -1,4 +1,11 @@
 /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 //  This file implements the flex scanner for LLVM assembly languages files.
 //
 #include "llvm/Module.h"
 #include <list>
 #include "llvmAsmParser.h"
-#include <ctype.h>
-#include "Config/stdlib.h"
+#include <cctype>
+#include <cstdlib>
 
 #define RET_TOK(type, Enum, sym) \
   llvmAsmlval.type = Instruction::Enum; return sym
 
+namespace llvm {
 
 // TODO: All of the static identifiers are figured out by the lexer, 
 // these should be hashed to reduce the lexer size
@@ -114,6 +122,10 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) {
   return BOut;
 }
 
+} // End llvm namespace
+
+using namespace llvm;
+
 #define YY_NEVER_INTERACTIVE 1
 %}
 
@@ -129,7 +141,7 @@ VarID       %[-a-zA-Z$._][-a-zA-Z$._0-9]*
 Label       [-a-zA-Z$._0-9]+:
 
 /* Quoted names can contain any character except " and \ */
-StringConstant \"[^\"]+\"
+StringConstant \"[^\"]*\"
 
 
 /* [PN]Integer: match positive and negative literal integer values that
@@ -219,12 +231,14 @@ setgt           { RET_TOK(BinaryOpVal, SetGT, SETGT); }
 setle           { RET_TOK(BinaryOpVal, SetLE, SETLE); }
 setge           { RET_TOK(BinaryOpVal, SetGE, SETGE); }
 
-phi             { RET_TOK(OtherOpVal, PHINode, PHI); }
+phi             { RET_TOK(OtherOpVal, PHI, PHI_TOK); }
 call            { RET_TOK(OtherOpVal, Call, CALL); }
 cast            { RET_TOK(OtherOpVal, Cast, CAST); }
 shl             { RET_TOK(OtherOpVal, Shl, SHL); }
 shr             { RET_TOK(OtherOpVal, Shr, SHR); }
-va_arg          { RET_TOK(OtherOpVal, VarArg, VA_ARG); }
+va_arg          { return VA_ARG; /* FIXME: OBSOLETE */}
+vanext          { RET_TOK(OtherOpVal, VANext, VANEXT); }
+vaarg           { RET_TOK(OtherOpVal, VAArg , VAARG); }
 
 ret             { RET_TOK(TermOpVal, Ret, RET); }
 br              { RET_TOK(TermOpVal, Br, BR); }