Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'instance': 0.05; 'char': 0.07; 'python': 0.08; '21,': 0.09; 'solution,': 0.09; 'subject:parsing': 0.09; 'output': 0.11; 'am,': 0.13; 'wrote:': 0.15; 'brackets': 0.16; "else's": 0.16; 'cc:addr:python-list': 0.16; 'continuing': 0.17; 'rewrite': 0.19; 'previously': 0.19; 'raymond': 0.19; 'seems': 0.20; 'cc:2**0': 0.21; 'column': 0.22; 'cc:no real name:2**0': 0.22; "doesn't": 0.22; 'header:In-Reply- To:1': 0.22; 'somewhere': 0.23; 'code': 0.24; '(or': 0.25; 'function': 0.26; 'somebody': 0.28; 'lee': 0.28; 'thu,': 0.28; 'message-id:@mail.gmail.com': 0.28; 'correct': 0.29; "didn't": 0.29; 'script': 0.29; 'forgot': 0.29; 'fixed': 0.29; 'fix': 0.29; 'cc:addr:python.org': 0.30; 'thanks': 0.31; 'least': 0.31; 'minor': 0.32; 'words,': 0.32; 'file.': 0.32; 'instead': 0.34; '(as': 0.34; 'e.g.': 0.34; 'define': 0.35; 'file': 0.36; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85.161': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'problem.': 0.38; 'else': 0.38; 'should': 0.39; 'received:209': 0.40; 'did': 0.40; 'where': 0.40; 'stop': 0.61; 'works,': 0.68; 'subjectcharset:utf-8': 0.72; 'skip:c 50': 0.77; 'xah': 0.84; 'subject:little': 0.91; 'invest': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=nNJunyFNko/Pjj+KkwCAYQcMNWeSPHjfKtRwg9SINww=; b=uQFWFwHoz0b4tFA8xPVv+kiR3EQObyRSmx4dZNsEwu530+QSL+5v9GCoY3oBFui3Ez ApZpPTxFTdrhTlsveXa3r26F+5r3QDmfVBNQgdvL6Rzrp8uHYVpWvtn2xPEewYEmGs7J DKWIl3gwYQGZ6TqKaZhjmrRbs/CoVC7vFFs+I= MIME-Version: 1.0 In-Reply-To: References: <36037253-086b-4467-a1db-9492d3772e78@r5g2000prf.googlegroups.com> <99245842-e205-4a34-8f9d-c64d41e044b6@j9g2000prj.googlegroups.com> <2a67a8cd-d3f0-4af9-9105-6551344b0277@t8g2000prm.googlegroups.com> From: Ian Kelly Date: Thu, 21 Jul 2011 08:26:32 -0600 Subject: =?UTF-8?Q?Re=3A_a_little_parsing_challenge_=E2=98=BA?= To: Xah Lee Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311258423 news.xs4all.nl 23964 [2001:888:2000:d::a6]:45494 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10026 On Thu, Jul 21, 2011 at 6:58 AM, Xah Lee wrote: > Thanks a lot for the fix Raymond. That fix was from Thomas Jollans, not Raymond Hettinger. > Though, the code seems to have a minor problem. > It works, but the report is wrong. > e.g. output: > > 30068: c:/Users/h3/web/xahlee_org/p/time_machine\tm-ch04.html > > that 30068 position is the last char in the file. > The correct should be 28319. (or at least point somewhere in the file > at a bracket char that doesn't match.) Previously you wrote: > If a file has mismatched matching-pairs, the script will display the > file name, and the line number and column number of the first > instance where a mismatched bracket occures. (or, just the char number > instead (as in emacs's =93point=94)) I submit that as the file contains no mismatched brackets (only an orphan bracket), the output is correct to specification (indeed you did not define any output for this case), if not necessarily useful. In other words, stop being picky. You may be willing to spend an hour or moe on this, but that doesn't mean anybody else is. Raymond gave you a basically working Python solution, but forgot one detail. Thomas fixed that detail for you but didn't invest the time to rewrite somebody else's function to get the output "correct". Continuing to harp on it at this point is verging on trolling.