diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-11-09 19:27:28 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-11-09 19:27:28 +0000 |
commit | 6ba2859ff51745038306c59d4fe9eefe6f164aff (patch) | |
tree | dcecae2def6bbf59eb3e675c1f90a62d93f902c7 /usr.bin/bc | |
parent | 96c234df114fdc987247d9b5e4ffbaf2025f80a9 (diff) |
Introduce `last' as a synonym for `.' and document them.
Diffstat (limited to 'usr.bin/bc')
-rw-r--r-- | usr.bin/bc/USD.doc/bc | 7 | ||||
-rw-r--r-- | usr.bin/bc/bc.1 | 6 | ||||
-rw-r--r-- | usr.bin/bc/scan.l | 5 |
3 files changed, 13 insertions, 5 deletions
diff --git a/usr.bin/bc/USD.doc/bc b/usr.bin/bc/USD.doc/bc index b1695909a96..18dbfa48e55 100644 --- a/usr.bin/bc/USD.doc/bc +++ b/usr.bin/bc/USD.doc/bc @@ -1,4 +1,4 @@ -.\" $OpenBSD: bc,v 1.4 2003/10/22 12:25:13 otto Exp $ +.\" $OpenBSD: bc,v 1.5 2003/11/09 19:27:27 otto Exp $ .\" .\" Copyright (C) Caldera International Inc. 2001-2002. .\" All rights reserved. @@ -783,7 +783,7 @@ The following are reserved keywords: length return while quit for continue - else + else last .fi .ft .NH 2 @@ -798,6 +798,9 @@ Expressions .PP The value of an expression is printed unless the main operator is an assignment. +The value printed is assigned to the special variable \fBlast\fP. +A single dot may be used as a synonym for \fBlast\fP. +This is a non-portable extension. Precedence is the same as the order of presentation here, with highest appearing first. Left or right associativity, where applicable, is diff --git a/usr.bin/bc/bc.1 b/usr.bin/bc/bc.1 index a71577f4106..470a45826bc 100644 --- a/usr.bin/bc/bc.1 +++ b/usr.bin/bc/bc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bc.1,v 1.9 2003/10/22 12:24:41 otto Exp $ +.\" $OpenBSD: bc.1,v 1.10 2003/11/09 19:27:27 otto Exp $ .\" .\" Copyright (C) Caldera International Inc. 2001-2002. .\" All rights reserved. @@ -91,6 +91,7 @@ Names simple variables: L array elements: L [ E ] The words `ibase', `obase', and `scale' +The word `last' or a single dot .Ed .Pp Other operands @@ -167,6 +168,9 @@ All function arguments are passed by value. .Pp The value of a statement that is an expression is printed unless the main operator is an assignment. +The value printed is assigned to the special variable `last'. +This is a non-portable extension. +A single dot may be used as a synonym for `last'. Either semicolons or newlines may separate statements. Assignment to .Ar scale diff --git a/usr.bin/bc/scan.l b/usr.bin/bc/scan.l index 541b814e97c..1a4fd2a8957 100644 --- a/usr.bin/bc/scan.l +++ b/usr.bin/bc/scan.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: scan.l,v 1.9 2003/10/18 20:35:36 otto Exp $ */ +/* $OpenBSD: scan.l,v 1.10 2003/11/09 19:27:27 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -18,7 +18,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: scan.l,v 1.9 2003/10/18 20:35:36 otto Exp $"; +static const char rcsid[] = "$OpenBSD: scan.l,v 1.10 2003/11/09 19:27:27 otto Exp $"; #endif /* not lint */ #include <err.h> @@ -109,6 +109,7 @@ DIGIT [0-9A-F] "else" return ELSE; "ibase" return IBASE; "if" return IF; +"last" return DOT; "for" return FOR; "length" return LENGTH; "obase" return OBASE; |