Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43465 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4735 invoked from network); 25 Mar 2009 17:49:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2009 17:49:02 -0000 Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.44.28 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 74.125.44.28 yx-out-2324.google.com Received: from [74.125.44.28] ([74.125.44.28:4194] helo=yx-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/53-30978-D8E6AC94 for ; Wed, 25 Mar 2009 12:49:02 -0500 Received: by yx-out-2324.google.com with SMTP id 3so105094yxj.83 for ; Wed, 25 Mar 2009 10:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=yB4E0iR02/KKrx9//Vgb+99dF2xK6hrsYlK454AXEMQ=; b=tX3Bz8xs4wZVqEpBmzLu+lw2IihshT/zOQFjIv+nm7zjs2dYQjn0BS8G7LkxPci06O KA5Xw7ke+aXRKPvV2n/d57QmllH6XqtDY+uyBVoz16H3xgqDJPltbt4p/VSM4ikSE0t6 uxVbru/Q0WLRc5ehgTLJ86Cg0nUmfwXYLRxuE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=sZW+XU1CMIQSXShw65s07xB/GACNr34El1lI4pASBRipxNuohNg0NYDTNj+UOztotn DS/OolQr3JMuh4/96Q1c8Lx77GCtYUZ22+NvUiOyxDhEUOv3ZmHnpEfL7hdQNXFszS5T 5KJ837Xo/dDZ4lhkmMlMy+DT4uO0MzJ5UP5C0= MIME-Version: 1.0 Received: by 10.100.3.13 with SMTP id 13mr1300886anc.40.1238003338759; Wed, 25 Mar 2009 10:48:58 -0700 (PDT) In-Reply-To: <14.C2.30978.F466AC94@pb1.pair.com> References: <14.C2.30978.F466AC94@pb1.pair.com> Date: Wed, 25 Mar 2009 20:48:58 +0300 Message-ID: To: Jeremy Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Access to syntax tree? From: indeyets@gmail.com (Alexey Zakhlestin) On Wed, Mar 25, 2009 at 8:13 PM, Jeremy wrote: > Is there any way to access the parse tree of a PHP file from within PHP? will this work for you? http://docs.php.net/manual/en/tokenizer.examples.php > I'm trying to write a code-checking utility to find namespace-related > problems in code and alert me to them. =C2=A0Specifically: > > namespace foo\bar; > > function foobar() > { > =C2=A0 =C2=A0 =C2=A0 =C2=A0try > =C2=A0 =C2=A0 =C2=A0 =C2=A0{ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0... > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > =C2=A0 =C2=A0 =C2=A0 =C2=A0catch(Exception $e) > =C2=A0 =C2=A0 =C2=A0 =C2=A0{ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//nothing will be = caught > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//I forgot to qual= ify > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//code silently fa= ils > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > } > > I didn't want to put a whole lot of work into this, so I'm trying to avoi= d > having to write in C/flex/ANTLR/etc. =C2=A0There's a bit of grease-monkey > internals stuff in PHP so I thought I would check. > > Thanks, > Jeremy > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Alexey Zakhlestin http://www.milkfarmsoft.com/