diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-04-07 15:05:13 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-04-07 15:05:13 +0000 |
commit | 9400e38dcb6abc2e719f00330fa23a4290c1ec40 (patch) | |
tree | 5f50b640411cb148c8467bf8957a972766c83873 /regress/usr.bin | |
parent | 6248a3a482e57395d11737d061d7c693b6732c3d (diff) |
Almost complete implementation of roff(7) numerical expressions.
Support all binary operators except ';' (scale conversion).
Fully support chained operations and nested parentheses.
Use this for the .nr, .if, and .ie requests.
While here, fix parsing of integer numbers in roff_getnum().
Diffstat (limited to 'regress/usr.bin')
-rw-r--r-- | regress/usr.bin/mandoc/roff/cond/numeric.in | 30 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/roff/cond/numeric.out_ascii | 6 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/roff/nr/Makefile | 4 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/roff/nr/eval.in | 67 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/roff/nr/eval.out_ascii | 33 |
5 files changed, 136 insertions, 4 deletions
diff --git a/regress/usr.bin/mandoc/roff/cond/numeric.in b/regress/usr.bin/mandoc/roff/cond/numeric.in index 88e048a271b..ab154d61575 100644 --- a/regress/usr.bin/mandoc/roff/cond/numeric.in +++ b/regress/usr.bin/mandoc/roff/cond/numeric.in @@ -1,4 +1,4 @@ -.TH COND-NUMERIC 1 "October 3, 2013" OpenBSD +.TH COND-NUMERIC 1 "April 7, 2014" OpenBSD .SH NAME cond-numeric \- roff conditions involving numbers .SH DESCRIPTION @@ -98,3 +98,31 @@ mp pm .ie 1>-2 (t) .el (f) +.PP +operator "&": +00 +.ie 0&0 (t) +.el (f) +01 +.ie 0&1 (t) +.el (f) +10 +.ie 1&0 (t) +.el (f) +11 +.ie 1&1 (t) +.el (f) +.PP +operator ":": +00 +.ie 0:0 (t) +.el (f) +01 +.ie 0:1 (t) +.el (f) +10 +.ie 1:0 (t) +.el (f) +11 +.ie 1:1 (t) +.el (f) diff --git a/regress/usr.bin/mandoc/roff/cond/numeric.out_ascii b/regress/usr.bin/mandoc/roff/cond/numeric.out_ascii index 6db189ac75b..4874f2146b5 100644 --- a/regress/usr.bin/mandoc/roff/cond/numeric.out_ascii +++ b/regress/usr.bin/mandoc/roff/cond/numeric.out_ascii @@ -26,6 +26,10 @@ DDEESSCCRRIIPPTTIIOONN with negative numbers: mm (t) mp (t) pm (t) + operator "&": 00 (f) 01 (f) 10 (f) 11 (t) + operator ":": 00 (f) 01 (t) 10 (t) 11 (t) -OpenBSD October 3, 2013 COND-NUMERIC(1) + + +OpenBSD April 7, 2014 COND-NUMERIC(1) diff --git a/regress/usr.bin/mandoc/roff/nr/Makefile b/regress/usr.bin/mandoc/roff/nr/Makefile index 19e66eb2ae0..e642dadeb26 100644 --- a/regress/usr.bin/mandoc/roff/nr/Makefile +++ b/regress/usr.bin/mandoc/roff/nr/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.4 2014/04/05 20:33:38 schwarze Exp $ +# $OpenBSD: Makefile,v 1.5 2014/04/07 15:05:12 schwarze Exp $ -REGRESS_TARGETS = int argc predef rr +REGRESS_TARGETS = argc eval int predef rr .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/roff/nr/eval.in b/regress/usr.bin/mandoc/roff/nr/eval.in new file mode 100644 index 00000000000..16bf24e3b5d --- /dev/null +++ b/regress/usr.bin/mandoc/roff/nr/eval.in @@ -0,0 +1,67 @@ +.TH NR-EVAL 1 "April 7, 2014" OpenBSD +.SH NAME +nr-eval \- numeric expressions in assignments to number registers +.SH DESCRIPTION +.nr mr 1 +1: \n(mr +.br +.nr mr nonumber +nonumber: \n(mr +.br +.nr mr 3X +3X: \n(mr +.br +.nr mr 4+ +4+: \n(mr +.br +.nr mr 2+3 +2+3: \n(mr +.br +.nr mr 1+1: +1+1:: \n(mr +.br +.nr mr 10-3 +10-3: \n(mr +.br +.nr mr 4*2 +4*2: \n(mr +.br +.nr mr 27/3 +27/3: \n(mr +.br +.nr mr 58%16 +58%16: \n(mr +.br +.nr mr 11<?20 +11<?20: \n(mr +.br +.nr mr 30<?12 +30<?12: \n(mr +.br +.nr mr 7>?13 +7>?13: \n(mr +.br +.nr mr 14>?6 +14>?6: \n(mr +.br +.nr mr 2+3*3 +2+3*3: \n(mr +.br +.nr mr 16+( +para at eol: \n(mr +.br +.nr mr (17 +unclosed para: \n(mr +.br +.nr mr (18) +(18): \n(mr +.br +.nr mr ( 25 - 6 ) +( 25 - 6 ): \n(mr +.br +.nr mr 11+( 3*3 ) +11+( 3*3 ): \n(mr +.br +.nr mr 3+(3*(5==5*2)*4)+(3*5)/2 +3+(3*(5==5*2)*4)+(3*5)/2: \n(mr +.br diff --git a/regress/usr.bin/mandoc/roff/nr/eval.out_ascii b/regress/usr.bin/mandoc/roff/nr/eval.out_ascii new file mode 100644 index 00000000000..b2edcc52532 --- /dev/null +++ b/regress/usr.bin/mandoc/roff/nr/eval.out_ascii @@ -0,0 +1,33 @@ +NR-EVAL(1) OpenBSD Reference Manual NR-EVAL(1) + + + +NNAAMMEE + nr-eval - numeric expressions in assignments to number registers + +DDEESSCCRRIIPPTTIIOONN + 1: 1 + nonumber: 1 + 3X: 3 + 4+: 3 + 2+3: 5 + 1+1:: 5 + 10-3: 7 + 4*2: 8 + 27/3: 9 + 58%16: 10 + 11<?20: 11 + 30<?12: 12 + 7>?13: 13 + 14>?6: 14 + 2+3*3: 15 + para at eol: 15 + unclosed para: 17 + (18): 18 + ( 25 - 6 ): 19 + 11+( 3*3 ): 20 + 3+(3*(5==5*2)*4)+(3*5)/2: 21 + + + +OpenBSD April 7, 2014 NR-EVAL(1) |