bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] inconsistent syntax error with comparison operators


From: Stéphane Campinas
Subject: Re: [bug-gawk] inconsistent syntax error with comparison operators
Date: Thu, 13 Dec 2018 15:05:11 +0100
User-agent: NeoMutt/20180716

On Thu, Dec 13, 2018 at 06:39:37AM -0700, david kerns wrote:
> On Thu, Dec 13, 2018 at 6:32 AM Stéphane Campinas <
> address@hidden> wrote:
> 
> > Hi,
> >
> > I have found some inconsistencies regarding syntax errors for comparison
> > operators.
> >
> > For example, the following script works:
> >
> >         { print 1 2 == 2 > 3 }
> >
> > However, replacing '>' with '<' returns an error (with error code 1):
> >
> >         { print 1 2 == 2 < 3 }
> >         gawk: cmd. line:1: { print 1 2 == 2 < 3 }
> >         gawk: cmd. line:1:                  ^ syntax error
> >
> > This happens with the version `GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1,
> > GNU MP 6.1.2)`.
> >
> > The script doesn't mean anything but the goal is to know what input are
> > accepted since I'm trying to create a AWK interpreter and found this
> > inconsistency while creating the parser.
> >
> > Cheers,
> >
> > --
> > Stephane Campinas
> >
> 
> 
> I think you're being "tricked" by operator overload of ">" ...
> 
>  { print 1 2 == 2 > 3 }
> 
> in the above example ">" is not seen as greater-than but as I/O redirection
> 
> but when you replace it with "<", which is not overloaded, you get the
> syntax error

Thanks David, I realised that after seeing a bunch of files that got created
with my tries...
Sorry for the noise.

-- 
Anything free is worth what you pay for it.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]