From owner-svn-src-head@FreeBSD.ORG Fri Jun 18 16:07:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B4381065673; Fri, 18 Jun 2010 16:07:25 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A9508FC08; Fri, 18 Jun 2010 16:07:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5IG7POs005201; Fri, 18 Jun 2010 16:07:25 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5IG7PjF005199; Fri, 18 Jun 2010 16:07:25 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201006181607.o5IG7PjF005199@svn.freebsd.org> From: Alexander Kabaev Date: Fri, 18 Jun 2010 16:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209305 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2010 16:07:25 -0000 Author: kan Date: Fri Jun 18 16:07:24 2010 New Revision: 209305 URL: http://svn.freebsd.org/changeset/base/209305 Log: Do not allow EOF token to be put back into input buffer. This reimplements previous change from r20930 in more generic way. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Fri Jun 18 15:25:57 2010 (r209304) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Fri Jun 18 16:07:24 2010 (r209305) @@ -45,7 +45,7 @@ #undef input #undef unput #else -/* +/* * Define YY_INPUT for flex since input() can't be re-defined. */ #define YY_INPUT(buf,result,max_size) \ @@ -60,6 +60,15 @@ buf[n] = *yypcb->pcb_strptr++; \ result = n; \ } +/* + * Do not EOF let tokens to be put back. This does not work with flex. + * On the other hand, leaving current buffer in same state it was when + * last EOF was received guarantees that input() will keep returning EOF + * for all subsequent invocations, which is the effect desired. + */ +#undef unput +#define unput(c) \ + if (c != EOF) yyunput( c, yytext_ptr ) #endif static int id_or_type(const char *); @@ -811,8 +820,7 @@ id_or_type(const char *s) longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); } - if (c0 != EOF) - unput(c0); + unput(c0); return (ttok); }