git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [idea] Converting sha1 evaluator into parser/interpreter
@ 2006-05-21  8:06 Jakub Narebski
  2006-05-21 10:13 ` Jakub Narebski
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Narebski @ 2006-05-21  8:06 UTC (permalink / raw)
  To: git

Shawn Pearce wrote:

> There was just a short conversation on #git about converting
> the sha1 expression evaluator into a split parser/interpreter
> model.  The idea here would be to convert an expression such as
> 
>   HEAD@{yesterday}~3^{tree}
> 
> into a an expression tree such as (in LISP style):
> 
>   (peel-onion (walk-back 3 (date-spec yesterday (ref HEAD))))

Rather

    (peel-onion 'tree (walk-back 3 (date-spec yesterday (ref HEAD))))
 
> with such a tree it is relatively easy to evaluate the expression,
> but its also easy to determine if a ref name is valid.  Just pass
> it through the parser and see if you get back anything more complex
> then '(ref <input>)'.

Didn't you meant to see if we get correct tree (not a forest), 
and if the root of said tree is '(ref <commit-ish>)' [1]?

Interpreting said parse tree anch checking if it folds to correct object
reference is the task of interpreter, not parser...


[*1*] if I understand currectly that <commit-ish> mean direct sha1,
shortened sha1, or ref (head or tag)? commit-ish is not in 
git glossary...

-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [idea] Converting sha1 evaluator into parser/interpreter
  2006-05-21  8:06 [idea] Converting sha1 evaluator into parser/interpreter Jakub Narebski
@ 2006-05-21 10:13 ` Jakub Narebski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Narebski @ 2006-05-21 10:13 UTC (permalink / raw)
  To: git

Jakub Narebski wrote:

> Shawn Pearce wrote:
> 
>> There was just a short conversation on #git about converting
>> the sha1 expression evaluator into a split parser/interpreter
>> model.  The idea here would be to convert an expression such as
>> 
>>   HEAD@{yesterday}~3^{tree}
>> 
>> into a an expression tree such as (in LISP style):
>> 
>>   (peel-onion (walk-back 3 (date-spec yesterday (ref HEAD))))
>>
>> with such a tree it is relatively easy to evaluate the expression,
>> but its also easy to determine if a ref name is valid.  Just pass
>> it through the parser and see if you get back anything more complex
>> then '(ref <input>)'.
> 
> Didn't you meant to see if we get correct tree (not a forest), 
> and if the root of said tree is '(ref <commit-ish>)' [1]?

I'm sorry. Of course branch names (ref names) should be limited to the ones
that doesn't make problems for the parser, i.e. they should parse to single
element parse tree:

   <input> ---parses to---> (ref <input>)

and doesn't give problems for other parsers (e.g.commit list parser
including '^A B' and 'A..B'; remotes branch mapping parser 'srcref:destref'
and '+srcref:destref') and shell (e.g. globbing).


P.S. Hmmm... is '--' branch name (heads/--) possible?
P.P.S. Would branch name which include '!' and/or '$' cause trouble?

-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-21 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-21  8:06 [idea] Converting sha1 evaluator into parser/interpreter Jakub Narebski
2006-05-21 10:13 ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).