In fact the problem with this one is actually indeed somewhere else. It's
btparse and us disagreeing about what's valid. Btparse apparently does not
regard the backslash as an escape for balancing braces, while we do in
copyStringFromNoteField. If we follow btparse's rule and just ignore the
backslash there won't be a problem.

Christiaan

On Jan 17, 2008 12:52 AM, Christiaan Hofman <[EMAIL PROTECTED]> wrote:

> This one confuses me. First of all, if there is a bibtex syntax error
> it's btparse that should catch it. I see no reason why detexification
> should catch bibtex parsing errors, in particular as it does not
> explicitly look for bibtex parsing errors. In fact I don't even think
> this particular case should be considered a bug from the POV of
> detexification. For example some TeX like  \{ without matching
> closing brace is perfectly valid tex. I don't know how this one
> should be handled, but it should be catched somewhere else.
>
> Christiaan
>
> On 17 Jan 2008, at 12:43 AM, Adam R. Maxwell wrote:
>
> >  Going back to the commit log and e-mail to the develop list a year
> > ago, Mike posted this:
> >
> > @inproceedings{Liu04EXPERT,
> >       Abstract = {Studying program behavior is a central component in
> > architectural designs. In this paper, we study and exploit one aspect
> > of program behavior, the behavior repetition, to expedite simulation.
> > Detailed architectural simulation can be long and computationally
> > expensive. Various alternatives are commonly used to simulate a much
> > smaller instruction stream to evaluate design choices: using a
> > reduced input set or simulating only a small window of the
> > instruction stream. In this paper, we propose to reduce the amount of
> > detailed simulation by avoiding simulating repeated code sections
> > that demonstrate stable behavior. By characterizing program behavior
> > repetition and use the information to select a subset of instructions
> > for detailed simulation, we can significantly speed up the process
> > without affecting the accuracy. In most cases, simulation time of
> > full-length SPEC CPU2000 benchmarks is reduced from hundreds of hours
> > to a few hours. The average error incurred is only about 1\{\%} or
> > less for a range of metrics.},
> > Title = {TEST},
> > Author = {Mike McC}}
> >
> > ...which with your changes no longer shows an error message
> > (printing to standard error doesn't count).  I added the nil return
> > specifically to catch this syntax error, and it's noted in the
> > parser's addValuesFromEntryToDictionary function.  What other
> > BibTeX syntax errors do we ignore when parsing a file?
> >
> > On Wednesday, January 16, 2008, at 03:21PM, "Christiaan Hofman"
> > <[EMAIL PROTECTED]> wrote:
> >> We convert what we can, and not what we can't, anyway. Why would
> >> these braces be any different from another tex syntax error? Also,
> >> there seems to be only a single place where we might be interested in
> >> syntax errors (namely the parser). The only syntax error that is
> >> checked here is non-matching braces. However the bibtex parser is the
> >> one place where non-matching braces can never occur (otherwise
> >> btparse would have already raised). So it would be a no-op anyway.
> >>
> >> Christiaan
> >>
> >> On 17 Jan 2008, at 12:14 AM, Adam R. Maxwell wrote:
> >>
> >>> I don't think it's like cleaning at all.  It's primary purpose is
> >>> conversion when parsing BibTeX, not temporary changing for display
> >>> (as in stringByRemovingTeX).  It ultimately affects what gets saved
> >>> back out to disk, so it's part of a critical data path.
> >>>
> >>> On Wednesday, January 16, 2008, at 03:10PM, "Christiaan Hofman"
> >>> <[EMAIL PROTECTED]> wrote:
> >>>> Isn't detexification something like cleaning? In particular as we
> >>>> don't check lots of other tex mistakes either without returning
> >>>> nil.
> >>>> Why would this be considered an error?
> >>>>
> >>>> Christiaan
> >>>>
> >>>> On 17 Jan 2008, at 12:03 AM, Adam R. Maxwell wrote:
> >>>>
> >>>>> Is this a good idea?  I think returning nil from a syntax error is
> >>>>> generally a good thing, and that's precisely the reason I added
> >>>>> that.  We check for a nil return in BibTeXParser, and other parts
> >>>>> of the code should check for it as well.
> >>>>>
> >>>>> On Wednesday, January 16, 2008, at 02:50PM,
> >>>>> <[EMAIL PROTECTED]> wrote:
> >>>>>> Revision: 12523
> >>>>>>          http://bibdesk.svn.sourceforge.net/bibdesk/?
> >>>>>> rev=12523&view=rev
> >>>>>> Author:   hofman
> >>>>>> Date:     2008-01-16 14:50:39 -0800 (Wed, 16 Jan 2008)
> >>>>>>
> >>>>>> Log Message:
> >>>>>> -----------
> >>>>>> Don't return nil when detexification fails.
> >>>>>>
> >>>>>> Modified Paths:
> >>>>>> --------------
> >>>>>>    trunk/bibdesk/BDSKConverter.m
> >>>>>>
> >>>>>> Modified: trunk/bibdesk/BDSKConverter.m
> >>>>>> =================================================================
> >>>>>> ==
> >>>>>> --- trunk/bibdesk/BDSKConverter.m        2008-01-16 22:35:31 UTC
> (rev
> >>>>>> 12522)
> >>>>>> +++ trunk/bibdesk/BDSKConverter.m        2008-01-16 22:50:39 UTC
> (rev
> >>>>>> 12523)
> >>>>>> @@ -137,33 +137,39 @@
> >>>>>>     [self setDetexifyAccents:[wholeDict
> >>>>>> objectForKey:TEX_TO_ROMAN_ACCENTS_KEY]];
> >>>>>> }
> >>>>>>
> >>>>>> +- (NSString *)copyComplexString:(BDSKComplexString *)cs
> >>>>>> byCopyingStringNodesUsingSelector:(SEL)copySelector {
> >>>>>> +    NSEnumerator *nodeEnum = [[cs nodes] objectEnumerator];
> >>>>>> +    BDSKStringNode *node, *newNode;
> >>>>>> +    NSMutableArray *nodes = [[NSMutableArray alloc]
> >>>>>> initWithCapacity:[[cs nodes] count]];
> >>>>>> +    NSString *string;
> >>>>>> +
> >>>>>> +    while(node = [nodeEnum nextObject]){
> >>>>>> +        if([node type] == BSN_STRING){
> >>>>>> +            string = [self performSelector:copySelector
> >>>>>> withObject:[node value]];
> >>>>>> +            newNode = [[BDSKStringNode alloc]
> >>>>>> initWithQuotedString:string];
> >>>>>> +            [string release];
> >>>>>> +        } else {
> >>>>>> +            newNode = [node copy];
> >>>>>> +        }
> >>>>>> +        [nodes addObject:newNode];
> >>>>>> +        [newNode release];
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    string = [[NSString alloc] initWithNodes:nodes
> >>>>>> macroResolver:
> >>>>>> [cs macroResolver]];
> >>>>>> +    [nodes release];
> >>>>>> +    return string;
> >>>>>> +}
> >>>>>> +
> >>>>>> - (NSString *)copyStringByTeXifyingString:(NSString *)s{
> >>>>>>
> >>>>>>  // TeXify only string nodes of complex strings;
> >>>>>>  if([s isComplex]){
> >>>>>> -                BDSKComplexString *cs = (BDSKComplexString *)s;
> >>>>>> -                NSEnumerator *nodeEnum = [[cs nodes]
> objectEnumerator];
> >>>>>> -                BDSKStringNode *node, *newNode;
> >>>>>> -                NSMutableArray *nodes = [[NSMutableArray alloc]
> >>>>>> initWithCapacity:[[cs nodes] count]];
> >>>>>> -        NSString *string;
> >>>>>> -
> >>>>>> -                while(node = [nodeEnum nextObject]){
> >>>>>> -                        if([node type] == BSN_STRING){
> >>>>>> -                                string = [self
> copyStringByTeXifyingString:[node value]];
> >>>>>> -                if(string == nil) break;
> >>>>>> -                newNode = [[BDSKStringNode alloc]
> >>>>>> initWithQuotedString:string];
> >>>>>> -                [string release];
> >>>>>> -                        } else {
> >>>>>> -                                newNode = [node copy];
> >>>>>> -                        }
> >>>>>> -            [nodes addObject:newNode];
> >>>>>> -                        [newNode release];
> >>>>>> -                }
> >>>>>> -
> >>>>>> -        string = [[NSString alloc] initWithNodes:nodes
> >>>>>> macroResolver:[cs macroResolver]];
> >>>>>> -        [nodes release];
> >>>>>> -                return string;
> >>>>>> +        return [self copyComplexString:(BDSKComplexString *)s
> >>>>>> byCopyingStringNodesUsingSelector:_cmd];
> >>>>>>  }
> >>>>>> +
> >>>>>> +    if([NSString isEmptyString:s]){
> >>>>>> +        return [s retain];
> >>>>>> +    }
> >>>>>>
> >>>>>>     // we expect to find composed accented characters, as this is
> >>>>>> also what we use in the CharacterConversion plist
> >>>>>>     NSMutableString *precomposedString = [s mutableCopy];
> >>>>>> @@ -264,31 +270,14 @@
> >>>>>>
> >>>>>> - (NSString *)copyStringByDeTeXifyingString:(NSString *)s{
> >>>>>>
> >>>>>> -    if([NSString isEmptyString:s]){
> >>>>>> -        return [s retain];
> >>>>>> -    }
> >>>>>> -
> >>>>>>  // deTeXify only string nodes of complex strings;
> >>>>>>  if([s isComplex]){
> >>>>>> -                BDSKComplexString *cs = (BDSKComplexString *)s;
> >>>>>> -                NSEnumerator *nodeEnum = [[cs nodes]
> objectEnumerator];
> >>>>>> -                BDSKStringNode *node, *newNode;
> >>>>>> -                NSMutableArray *nodes = [NSMutableArray
> arrayWithCapacity:[[cs
> >>>>>> nodes] count]];
> >>>>>> -                NSString *string;
> >>>>>> -
> >>>>>> -                while(node = [nodeEnum nextObject]){
> >>>>>> -                        if([node type] == BSN_STRING){
> >>>>>> -                                string = [self
> copyStringByDeTeXifyingString:[node value]];
> >>>>>> -                                newNode = [[BDSKStringNode alloc]
> >>>>>> initWithQuotedString:string];
> >>>>>> -                [string release];
> >>>>>> -                        } else {
> >>>>>> -                                newNode = [node copy];
> >>>>>> -                        }
> >>>>>> -            [nodes addObject:newNode];
> >>>>>> -                        [newNode release];
> >>>>>> -                }
> >>>>>> -                return [[NSString alloc] initWithNodes:nodes
> macroResolver:[cs
> >>>>>> macroResolver]];
> >>>>>> +        return [self copyComplexString:(BDSKComplexString *)s
> >>>>>> byCopyingStringNodesUsingSelector:_cmd];
> >>>>>>  }
> >>>>>> +
> >>>>>> +    if([NSString isEmptyString:s]){
> >>>>>> +        return [s retain];
> >>>>>> +    }
> >>>>>>
> >>>>>>     NSMutableString *tmpConv = nil;
> >>>>>>     NSString *TEXString = nil;
> >>>>>> @@ -328,8 +317,7 @@
> >>>>>>                 range = [convertedSoFar rangeOfString:@"{\\"
> >>>>>> options:0 range:NSMakeRange(replaceRange.location + 1, length -
> >>>>>> replaceRange.location - 1)];
> >>>>>>             } else {
> >>>>>>                 NSLog(@"missing brace in string %@",
> >>>>>> convertedSoFar);
> >>>>>> -                [convertedSoFar release];
> >>>>>> -                return nil;
> >>>>>> +                range = NSMakeRange(NSNotFound, 0);
> >>>>>>             }
> >>>>>>
> >>>>>>         }
> >>>>>>
> >>>>>>
> >>>>>> This was sent by the SourceForge.net collaborative development
> >>>>>> platform, the world's largest Open Source development site.
> >>>>>>
> >>>>>> -----------------------------------------------------------------
> >>>>>> --
> >>>>>> --
> >>>>>> ----
> >>>>>> This SF.net email is sponsored by: Microsoft
> >>>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
> >>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >>>>>> _______________________________________________
> >>>>>> Bibdesk-commit mailing list
> >>>>>> [EMAIL PROTECTED]
> >>>>>> https://lists.sourceforge.net/lists/listinfo/bibdesk-commit
> >>>>>>
> >>>>>>
> >>>>>
> >>>>> ------------------------------------------------------------------
> >>>>> --
> >>>>> --
> >>>>> ---
> >>>>> This SF.net email is sponsored by: Microsoft
> >>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
> >>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >>>>> _______________________________________________
> >>>>> Bibdesk-develop mailing list
> >>>>> Bibdesk-develop@lists.sourceforge.net
> >>>>> https://lists.sourceforge.net/lists/listinfo/bibdesk-develop
> >>>>
> >>>>
> >>>> -------------------------------------------------------------------
> >>>> --
> >>>> ----
> >>>> This SF.net email is sponsored by: Microsoft
> >>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
> >>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >>>> _______________________________________________
> >>>> Bibdesk-develop mailing list
> >>>> Bibdesk-develop@lists.sourceforge.net
> >>>> https://lists.sourceforge.net/lists/listinfo/bibdesk-develop
> >>>>
> >>>>
> >>>
> >>> --------------------------------------------------------------------
> >>> --
> >>> ---
> >>> This SF.net email is sponsored by: Microsoft
> >>> Defy all challenges. Microsoft(R) Visual Studio 2008.
> >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >>> _______________________________________________
> >>> Bibdesk-develop mailing list
> >>> Bibdesk-develop@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/bibdesk-develop
> >>
> >>
> >> ---------------------------------------------------------------------
> >> ----
> >> This SF.net email is sponsored by: Microsoft
> >> Defy all challenges. Microsoft(R) Visual Studio 2008.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >> _______________________________________________
> >> Bibdesk-develop mailing list
> >> Bibdesk-develop@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/bibdesk-develop
> >>
> >>
> >
> > ----------------------------------------------------------------------
> > ---
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > Bibdesk-develop mailing list
> > Bibdesk-develop@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/bibdesk-develop
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-develop mailing list
Bibdesk-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to