Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Generating completion functions from XML



On Jul 19, 10:56am, Sven Wischnowsky wrote:
} Subject: Re: Generating completion functions from XML
}
} Felix Rosencrantz wrote:
} 
} > So I feared having to look at partially wrong _arguments calls.  That   
} > command has a lot of syntactic sugar and there is more on the way (e.g. 
} > recent changes).  It's not easy for me to remember what each special    
} > character and grouping does.                                            
} 
} Actually, the reason why some of the _argument calls hurt the eyes is
} that it has so littly syntactic sugar.
} 
} > It occurred to me that having an intermediate file format would be a    
} > good idea.  Possibly something that would be a little more descriptive, 
} > maybe even interspersed with comments and documentation (both from      
} > zsh & the command).  Also it should be easier to edit.  Also, it        
} > should make it easier to specify commands that have subcommands (e.g.   
} > cvs).  There would need to be a tool which transform this intermediate  
} > file format into the appropriate completion function, generating the    
} > appropriate call to _arguments, _values, etc.  Also, as the syntax to   
} > _arguments changed it would be possible to change this generation tool, 
} > and then regenerate the completion function.  Maybe even _arguments     
} > could even take this intermediate format file as input.                 
} 
} Btw. have you noticed Bart's _arg_compile function?

I haven't updated _arg_compile in quite some time; I'm not sure that it
still produces good _arguments calls.

Another possible output format for a more sugary input language may be
Tanaka's _regex_arguments, which presently is used only for the `xset'
and `xwit' commands and the Debian `apt' family of commands.  It might
be possible to produce better completions for many commands by using
_regex_arguments, but I confess that trying to comprehend that regex
syntax has always exceeded my available time or attention span.

} I'm not opposed to defining some language to make describing commands
} easier at all.  Be it XML or something else (everything has to be XML
} nowadays, right? at least until the next hype... ;-).

That pretty much sums up my feeling about XML.  I have yet to find an
editor that makes XML easier to edit than shell code.  Maybe I just
haven't tried a recent enough version of emacs, or something.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author