Re: detect shell script language

2006-09-05 Thread Bob McGowan
Some general comments about how I understand this stuff to work, a bit long, perhaps, but to be sure we're all on the same starting line. Also, due to being out of the office, I missed some of the earlier mails and so will most likely repeat some things that have already been said. My apolog

Re: detect shell script language

2006-09-05 Thread Scott Gifford
Lorenzo Bettini <[EMAIL PROTECTED]> writes: [...] > However, there are cases where this is not enough, since the script, > although it has #!/bin/sh is actually written (and interpreted) in > another language, e.g., Tcl. > > So my question is, is there another way of detecting the actual > langua

Re: detect shell script language

2006-09-05 Thread Lorenzo Bettini
Matej Cepl wrote: Lorenzo Bettini wrote: I was told that this was used to get around problems in older versions of shells. Wov! How old shell you have to have, which doesn't understand normal shebang line? don't ask me ;-) I read this reply on a forum where I posted a similar request... ch

Re: detect shell script language

2006-09-03 Thread Matej Cepl
Lorenzo Bettini wrote: > I was told that this was used to get around problems in older versions > of shells. Wov! How old shell you have to have, which doesn't understand normal shebang line? Matěj -- GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC http://www.ceplovi.cz/matej/blo

Re: detect shell script language

2006-09-03 Thread Lorenzo Bettini
Maxim Vexler wrote: (I'm thinking out loud here) go ahead :-) How about identifying patterns specific to each shell, and then implementing an algorithm that would produce score for each shell match. The one with the highest score will be the one used by src-highlite. This perhaps should be a

Re: detect shell script language

2006-09-03 Thread Lorenzo Bettini
Miles Bader wrote: Matej Cepl <[EMAIL PROTECTED]> writes: The mode name should appear in this line both preceded and followed by `-*-'. Other text may appear on the line as well. For example, ;-*-Lisp-*- Except that this is totally Emacs-specific and to the best of my knowledge nobody o

Re: detect shell script language

2006-09-03 Thread Lorenzo Bettini
Matej Cepl wrote: Lorenzo Bettini wrote: OK, so the line "exec ..." can be used as an heuristic for detecting the actual scripting language, right? I have no idea why they use this construct (something similar is used in some perl scripts when they try to be cross-platform between Unix and Win

Re: detect shell script language

2006-09-01 Thread Matej Cepl
Miles Bader wrote: > Nonetheless, if such a cookie is present, it's a great thing to use for > this purpose, as it's unambiguous. Sure, but still I would begin with parsing shebang (with some additions -- like Tcl), and then I would see how many scripts are ambiguous. Matěj -- GPG Finger: 89EF

Re: detect shell script language

2006-09-01 Thread Miles Bader
Matej Cepl <[EMAIL PROTECTED]> writes: >> The mode name should appear in this line both preceded and followed by >> `-*-'. Other text may appear on the line as well. For example, >> >> ;-*-Lisp-*- > > Except that this is totally Emacs-specific and to the best of my knowledge > nobody outsid

Re: detect shell script language

2006-09-01 Thread Maxim Vexler
On 9/1/06, Lorenzo Bettini <[EMAIL PROTECTED]> wrote: Ron Johnson wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Lorenzo Bettini wrote: >> Hi >> >> I need to detect the actual programming language of a script. >> >> A way of detecting it is to examine the first line searching for th

Re: detect shell script language

2006-09-01 Thread Matej Cepl
Jörg-Volker Peetz wrote: >> I need to detect the language of the script in order to highlight it >> accordingly (GNU source-highlight >> http://www.gnu.org/software/src-highlite) >> > See Emacs manual "How Major Modes are Chosen". It says > >You can specify which major mode should be used for

Re: detect shell script language

2006-09-01 Thread Matej Cepl
Lorenzo Bettini wrote: > OK, so the line "exec ..." can be used as an heuristic for detecting the > actual scripting language, right? I have no idea why they use this construct (something similar is used in some perl scripts when they try to be cross-platform between Unix and Windows, which appare

Re: detect shell script language

2006-09-01 Thread Lorenzo Bettini
Matej Cepl wrote: Ron Johnson wrote: IOW, "wish" is a Tcl script? wish is Tcl runtime (the same as /usr/bin/perl for Perl programs). OK, so the line "exec ..." can be used as an heuristic for detecting the actual scripting language, right? -- +--

Re: detect shell script language

2006-09-01 Thread Matej Cepl
Ron Johnson wrote: > IOW, "wish" is a Tcl script? wish is Tcl runtime (the same as /usr/bin/perl for Perl programs). Matěj -- GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC http://www.ceplovi.cz/matej/blog/, Jabber: [EMAIL PROTECTED] 23 Marion St. #3, (617) 876-1259, ICQ 1328222

Re: detect shell script language

2006-09-01 Thread Jörg-Volker Peetz
Lorenzo Bettini wrote: > I need to detect the language of the script in order to highlight it > accordingly (GNU source-highlight http://www.gnu.org/software/src-highlite) > See Emacs manual "How Major Modes are Chosen". It says You can specify which major mode should be used for editing a cer

Re: detect shell script language

2006-09-01 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lorenzo Bettini wrote: > Ron Johnson wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Lorenzo Bettini wrote: >>> Hi >>> >>> I need to detect the actual programming language of a script. >>> >>> A way of detecting it is to examine the fi

Re: detect shell script language

2006-09-01 Thread Lorenzo Bettini
Ron Johnson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lorenzo Bettini wrote: Hi I need to detect the actual programming language of a script. A way of detecting it is to examine the first line searching for the "sha-bang" (#!), e.g., #!/bin/bash or #!/usr/bin/perl However, ther

Re: detect shell script language

2006-09-01 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lorenzo Bettini wrote: > Hi > > I need to detect the actual programming language of a script. > > A way of detecting it is to examine the first line searching for the > "sha-bang" (#!), e.g., > > #!/bin/bash > > or > > #!/usr/bin/perl > > However

detect shell script language

2006-09-01 Thread Lorenzo Bettini
Hi I need to detect the actual programming language of a script. A way of detecting it is to examine the first line searching for the "sha-bang" (#!), e.g., #!/bin/bash or #!/usr/bin/perl However, there are cases where this is not enough, since the script, although it has #!/bin/sh is act