Fix the operator precedence list to match reality. Operators were incorrectly

grouped there.
This commit is contained in:
jdolecek 2001-05-07 10:14:43 +00:00
parent 7e6929fe90
commit 3b932d2fe1

View File

@ -1,4 +1,4 @@
.\" $NetBSD: expr.1,v 1.15 2000/10/30 16:20:12 jdolecek Exp $
.\" $NetBSD: expr.1,v 1.16 2001/05/07 10:14:43 jdolecek Exp $
.\"
.\" Written by J.T. Conklin <jtc@netbsd.org>.
.\" Public domain.
@ -15,7 +15,7 @@
.Sh DESCRIPTION
The
.Nm
utility evaluates
utility evaluates
.Ar expression
and writes the result on standard output.
.Pp
@ -28,8 +28,8 @@ Operators are listed below in order of increasing precedence.
Operators with equal precedence are grouped within { } symbols.
.Bl -tag -width indent
.It Ar expr1 Li | Ar expr2
Returns the evaluation of
.Ar expr1
Returns the evaluation of
.Ar expr1
if it is neither an empty string nor zero;
otherwise, returns the evaluation of
.Ar expr2 .
@ -39,7 +39,7 @@ Returns the evaluation of
if neither expression evaluates to an empty string or zero;
otherwise, returns zero.
.It Ar expr1 Li "{=, >, >=, <, <=, !=}" Ar expr2
Returns the results of integer comparison if both arguments are integers;
Returns the results of integer comparison if both arguments are integers;
otherwise, returns the results of string comparison using the locale-specific
collation sequence.
The result of each comparison is 1 if the specified relation is true,
@ -49,23 +49,23 @@ Returns the results of addition or subtraction of integer-valued arguments.
.It Ar expr1 Li "{*, /, %}" Ar expr2
Returns the results of multiplication, integer division, or remainder of integer-valued arguments.
.It Ar expr1 Li : Ar expr2
The
The
.Dq \:
operator matches
.Ar expr1
against
operator matches
.Ar expr1
against
.Ar expr2 ,
which must be a regular expression. The regular expression is anchored
to the beginning of the string with an implicit
to the beginning of the string with an implicit
.Dq ^ .
.Pp
If the match succeeds and the pattern contains at least one regular
expression subexpression
.Dq "\e(...\e)" ,
the string corresponding to
expression subexpression
.Dq "\e(...\e)" ,
the string corresponding to
.Dq "\e1"
is returned;
otherwise the matching operator returns the number of characters matched.
otherwise the matching operator returns the number of characters matched.
If the match fails and the pattern contains a regular expression subexpression
the null string is returned;
otherwise 0.
@ -78,15 +78,22 @@ Operator precedence (from highest to lowest):
.It
parentheses
.It
arithmetic operators, compare operators,
.Dq \:
operator
.It
.Dq "*" ,
.Dq "/" ,
and
.Dq "%"
.It
.Dq "+"
and
.Dq "-"
.It
compare operators
.It
.Dq &
operator
.It
.Dq \Z'\*[tty-rn]'|
operator
.El
.Sh EXAMPLES
.Bl -enum