[Thread Prev][Thread Next][Index]

Re: [ferret_users] inconsistency? in command line parser



 Hi Ryo,
Thanks for the report.  Command-line parsing is difficult.  Your example is very helpful, and I see your point; commas in combination with spaces for separating arguments shows some inconsistencies.

Ansley

On 10/1/2010 4:26 PM, Ryo Furue wrote:
Ferret users and developers,

I was hit by (apparent) inconsistency in command line parsing.

To illustrate the points, I made up two scripts "main" and "sub",
the former calling the latter.  They are reproduced below and
also attached to this message.

sub.jnl just prints the three arguments given to it:

!-- BEGIN: sub.jnl ---
say --($1%EMPTY1%)--($2%EMPTY2%)--($3%EMPTY3%)--
!-- END: sub.jnl ---

main.jnl is the test script to illustrate the problems:

!-- BEGIN: main.jnl ---
go sub a b c
go sub a[y=1] b c
go sub a, b, c
go sub a , b , c !! -->  3rd arg. is empty.

!go sub  , b, c !! -->  Error
go sub a,  , c
go sub a, b,

go sub a[y=1], b, c !! -->  "a[y=1]," is treated as argument.

go sub a \
     , b, c
go sub a, b \
     , c       !! -->  3rd arg. is empty.
!-- END: main.jnl ---

The following is the output (Ferret 6.61 on Linux):

--a--b--c--
--a[y=1]--b--c--
--a--b--c--
--a--b--EMPTY3--
--a--EMPTY2--c--
--a--b--EMPTY3--
--a[y=1],--b--c--
--a--b--c--
--a--b--EMPTY3--

It seems that the handling of commas has some inconsistency.

I'm not looking for workarounds.  I'm just suggesting that
this inconsistency be resolved in the future.

Regards,
Ryo


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement