diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-07-06 00:08:53 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-07-06 00:08:53 +0000 |
commit | 64da98b2200848a909217a97925e326be60b8eb2 (patch) | |
tree | a7e75fa9de1102786254e434ae1e3f7ec1fa01c8 /regress/usr.bin/mandoc | |
parent | 3bfa6cac118b9219cc28d93116433ad0217bcbe3 (diff) |
Fix operator precedence according to Brian W. Kernighan and Lorinda
L. Cherry, "Typesetting Mathematics - User's Guide (Second Edition)",
August 15, 1978, paragraph 23; swarm of bugs pointed out by bentley@.
Diffstat (limited to 'regress/usr.bin/mandoc')
20 files changed, 82 insertions, 29 deletions
diff --git a/regress/usr.bin/mandoc/eqn/fromto/Makefile b/regress/usr.bin/mandoc/eqn/fromto/Makefile index a2012e8f932..1384c543153 100644 --- a/regress/usr.bin/mandoc/eqn/fromto/Makefile +++ b/regress/usr.bin/mandoc/eqn/fromto/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.2 2015/01/01 15:34:43 schwarze Exp $ +# $OpenBSD: Makefile,v 1.3 2017/07/06 00:08:52 schwarze Exp $ -REGRESS_TARGETS = basic noarg -HTML_TARGETS = basic noarg +REGRESS_TARGETS = basic noarg precedence +HTML_TARGETS = basic noarg precedence .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/eqn/fromto/precedence.in b/regress/usr.bin/mandoc/eqn/fromto/precedence.in new file mode 100644 index 00000000000..939ab51a9ff --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/fromto/precedence.in @@ -0,0 +1,15 @@ +.\" $OpenBSD: precedence.in,v 1.1 2017/07/06 00:08:52 schwarze Exp $ +.Dd $Mdocdate: July 6 2017 $ +.Dt SUBSUP-PRECEDENCE 1 +.Os +.Sh NAME +.Nm subsup-precedence +.Nd precedence of subscripts and superscripts +.Sh DESCRIPTION +.ps 36 +initial text +.EQ +X from a under to c hat ; roman X from bold a to italic c ; +X sub 1 sup 2 from a sub c sup e to o sub r sup s +.EN +final text diff --git a/regress/usr.bin/mandoc/eqn/fromto/precedence.out_ascii b/regress/usr.bin/mandoc/eqn/fromto/precedence.out_ascii new file mode 100644 index 00000000000..23f3ca4a5d4 --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/fromto/precedence.out_ascii @@ -0,0 +1,9 @@ +SUBSUP-PRECEDENCE(1) General Commands Manual SUBSUP-PRECEDENCE(1) + +NNAAMMEE + ssuubbssuupp--pprreecceeddeennccee - precedence of subscripts and superscripts + +DDEESSCCRRIIPPTTIIOONN + initial text _X__a_^_c^ ; X_aa^_c ; _X_1^2__a__c^_e^_o__r^_s final text + +OpenBSD July 5, 2017 OpenBSD diff --git a/regress/usr.bin/mandoc/eqn/fromto/precedence.out_html b/regress/usr.bin/mandoc/eqn/fromto/precedence.out_html new file mode 100644 index 00000000000..bb9074e64b5 --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/fromto/precedence.out_html @@ -0,0 +1 @@ +<mrow><munderover><mi>X</mi><munder><mi>a</mi><mo>_</mo></munder><mover><mi>c</mi><mo>^</mo></mover></munderover><mo>;</mo><munderover><mrow><mi fontstyle="normal">X</mi></mrow><mrow><mi fontweight="bold">a</mi></mrow><mrow><mi>c</mi></mrow></munderover><mo>;</mo><munderover><msubsup><mi>X</mi><mn>1</mn><mn>2</mn></msubsup><msubsup><mi>a</mi><mi>c</mi><mi>e</mi></msubsup><msubsup><mi>o</mi><mi>r</mi><mi>s</mi></msubsup></munderover></mrow> diff --git a/regress/usr.bin/mandoc/eqn/over/precedence.in b/regress/usr.bin/mandoc/eqn/over/precedence.in index 3bc0e7fc86a..12b28cef4ea 100644 --- a/regress/usr.bin/mandoc/eqn/over/precedence.in +++ b/regress/usr.bin/mandoc/eqn/over/precedence.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: precedence.in,v 1.2 2017/07/04 14:53:23 schwarze Exp $ -.Dd $Mdocdate: July 4 2017 $ +.\" $OpenBSD: precedence.in,v 1.3 2017/07/06 00:08:52 schwarze Exp $ +.Dd $Mdocdate: July 6 2017 $ .Dt OVER-PRECEDENCE 1 .Os .Sh NAME @@ -8,6 +8,7 @@ .Sh DESCRIPTION initial text .EQ -1 + x + x sup 2 over 2 + x sup 3 over { 2 * 3 } +1 + x + x sup 2 over 2 + x sup 3 over { 2 * 3 } ; +a hat over c tilde ; bold a over bold c ; sqrt a over sqrt c .EN final text diff --git a/regress/usr.bin/mandoc/eqn/over/precedence.out_ascii b/regress/usr.bin/mandoc/eqn/over/precedence.out_ascii index 92529bb4340..a9a9684a36b 100644 --- a/regress/usr.bin/mandoc/eqn/over/precedence.out_ascii +++ b/regress/usr.bin/mandoc/eqn/over/precedence.out_ascii @@ -4,6 +4,7 @@ NNAAMMEE oovveerr--pprreecceeddeennccee - precedence of the fraction operator DDEESSCCRRIIPPTTIIOONN - initial text 1 + _x + _x^2/2 + _x^3/(2 * 3) final text + initial text 1 + _x + _x^2/2 + _x^3/(2 * 3) ; _a^/_c~ ; aa/cc ; sqrt(_a)/sqrt(_c) + final text -OpenBSD July 4, 2017 OpenBSD +OpenBSD July 5, 2017 OpenBSD diff --git a/regress/usr.bin/mandoc/eqn/over/precedence.out_html b/regress/usr.bin/mandoc/eqn/over/precedence.out_html index b7c4f36d526..52e45eb557f 100644 --- a/regress/usr.bin/mandoc/eqn/over/precedence.out_html +++ b/regress/usr.bin/mandoc/eqn/over/precedence.out_html @@ -1 +1 @@ -<mrow><mn>1</mn><mo>+</mo><mi>x</mi><mo>+</mo><mfrac><msup><mi>x</mi><mn>2</mn></msup><mn>2</mn></mfrac><mo>+</mo><mfrac><msup><mi>x</mi><mn>3</mn></msup><mrow><mn>2</mn><mo>*</mo><mn>3</mn></mrow></mfrac></mrow> +<mrow><mn>1</mn><mo>+</mo><mi>x</mi><mo>+</mo><mfrac><msup><mi>x</mi><mn>2</mn></msup><mn>2</mn></mfrac><mo>+</mo><mfrac><msup><mi>x</mi><mn>3</mn></msup><mrow><mn>2</mn><mo>*</mo><mn>3</mn></mrow></mfrac><mo>;</mo><mfrac><mover><mi>a</mi><mo>^</mo></mover><mover><mi>c</mi><mo>~</mo></mover></mfrac><mo>;</mo><mfrac><mrow><mi fontweight="bold">a</mi></mrow><mrow><mi fontweight="bold">c</mi></mrow></mfrac><mo>;</mo><mfrac><msqrt><mi>a</mi></msqrt><msqrt><mi>c</mi></msqrt></mfrac></mrow> diff --git a/regress/usr.bin/mandoc/eqn/subsup/Makefile b/regress/usr.bin/mandoc/eqn/subsup/Makefile index 4e11b33d5c5..a780104630e 100644 --- a/regress/usr.bin/mandoc/eqn/subsup/Makefile +++ b/regress/usr.bin/mandoc/eqn/subsup/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.2 2015/01/01 15:34:43 schwarze Exp $ +# $OpenBSD: Makefile,v 1.3 2017/07/06 00:08:52 schwarze Exp $ -REGRESS_TARGETS = combine noarg sub_group -HTML_TARGETS = combine noarg sub_group +REGRESS_TARGETS = combine noarg precedence sub_group +HTML_TARGETS = combine noarg precedence sub_group .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/eqn/subsup/precedence.in b/regress/usr.bin/mandoc/eqn/subsup/precedence.in new file mode 100644 index 00000000000..d184fc07088 --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/subsup/precedence.in @@ -0,0 +1,14 @@ +.\" $OpenBSD: precedence.in,v 1.1 2017/07/06 00:08:52 schwarze Exp $ +.Dd $Mdocdate: July 6 2017 $ +.Dt SUBSUP-PRECEDENCE 1 +.Os +.Sh NAME +.Nm subsup-precedence +.Nd precedence of subscripts and superscripts +.Sh DESCRIPTION +initial text +.EQ +x hat sub 1 under sup 2 bar + e tilde sup x hat sub s dyad ; +roman I sub bold I sup italic I + roman I sup bold I sub italic I +.EN +final text diff --git a/regress/usr.bin/mandoc/eqn/subsup/precedence.out_ascii b/regress/usr.bin/mandoc/eqn/subsup/precedence.out_ascii new file mode 100644 index 00000000000..b5b7f6c2d5a --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/subsup/precedence.out_ascii @@ -0,0 +1,9 @@ +SUBSUP-PRECEDENCE(1) General Commands Manual SUBSUP-PRECEDENCE(1) + +NNAAMMEE + ssuubbssuupp--pprreecceeddeennccee - precedence of subscripts and superscripts + +DDEESSCCRRIIPPTTIIOONN + initial text _x^_1_^2 + _e~^_x^__s<-> ; I_II^_I + I^II__I final text + +OpenBSD July 5, 2017 OpenBSD diff --git a/regress/usr.bin/mandoc/eqn/subsup/precedence.out_html b/regress/usr.bin/mandoc/eqn/subsup/precedence.out_html new file mode 100644 index 00000000000..1cad9ce2d94 --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/subsup/precedence.out_html @@ -0,0 +1 @@ +<mrow><msubsup><mover><mi>x</mi><mo>^</mo></mover><munder><mn>1</mn><mo>_</mo></munder><mover><mn>2</mn><mo></mo></mover></msubsup><mo>+</mo><msup><mover><mi>e</mi><mo>~</mo></mover><msub><mover><mi>x</mi><mo>^</mo></mover><mover><mi>s</mi><mo>↔</mo></mover></msub></msup><mo>;</mo><msubsup><mrow><mi fontstyle="normal">I</mi></mrow><mrow><mi fontweight="bold">I</mi></mrow><mrow><mi>I</mi></mrow></msubsup><mo>+</mo><msup><mrow><mi fontstyle="normal">I</mi></mrow><msub><mrow><mi fontweight="bold">I</mi></mrow><mrow><mi>I</mi></mrow></msub></msup></mrow> diff --git a/regress/usr.bin/mandoc/eqn/unary/bold.in b/regress/usr.bin/mandoc/eqn/unary/bold.in index ad098a83065..e77398f46e9 100644 --- a/regress/usr.bin/mandoc/eqn/unary/bold.in +++ b/regress/usr.bin/mandoc/eqn/unary/bold.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: bold.in,v 1.2 2017/07/04 14:53:23 schwarze Exp $ -.Dd $Mdocdate: July 4 2017 $ +.\" $OpenBSD: bold.in,v 1.3 2017/07/06 00:08:52 schwarze Exp $ +.Dd $Mdocdate: July 6 2017 $ .Dt UNARY-BOLD 1 .Os .Sh NAME @@ -8,6 +8,6 @@ .Sh DESCRIPTION initial text .EQ -bold { sin "sin" } +bold { sin "sin" } "text" bold x hat .EN final text diff --git a/regress/usr.bin/mandoc/eqn/unary/bold.out_ascii b/regress/usr.bin/mandoc/eqn/unary/bold.out_ascii index c20dc638a6b..a40528fc0ad 100644 --- a/regress/usr.bin/mandoc/eqn/unary/bold.out_ascii +++ b/regress/usr.bin/mandoc/eqn/unary/bold.out_ascii @@ -4,6 +4,6 @@ NNAAMMEE uunnaarryy--bboolldd - font handling in bold boxes DDEESSCCRRIIPPTTIIOONN - initial text ((sin ssiinn)) final text + initial text ((sin ssiinn)) _t_e_x_t xx^^ final text -OpenBSD July 4, 2017 OpenBSD +OpenBSD July 5, 2017 OpenBSD diff --git a/regress/usr.bin/mandoc/eqn/unary/bold.out_html b/regress/usr.bin/mandoc/eqn/unary/bold.out_html index 56d6762f913..e1263a4fd30 100644 --- a/regress/usr.bin/mandoc/eqn/unary/bold.out_html +++ b/regress/usr.bin/mandoc/eqn/unary/bold.out_html @@ -1 +1 @@ -<mrow><mrow><mrow><mi>sin</mi><mi fontweight="bold">sin</mi></mrow></mrow></mrow> +<mrow><mrow><mrow><mi>sin</mi><mi fontweight="bold">sin</mi></mrow></mrow><mi fontstyle="italic">text</mi><mrow><mover><mi fontweight="bold">x</mi><mo>^</mo></mover></mrow></mrow> diff --git a/regress/usr.bin/mandoc/eqn/unary/diacrit.in b/regress/usr.bin/mandoc/eqn/unary/diacrit.in index 6e91f847e1f..ab83dbb1b8b 100644 --- a/regress/usr.bin/mandoc/eqn/unary/diacrit.in +++ b/regress/usr.bin/mandoc/eqn/unary/diacrit.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: diacrit.in,v 1.2 2017/07/04 14:53:23 schwarze Exp $ -.Dd $Mdocdate: July 4 2017 $ +.\" $OpenBSD: diacrit.in,v 1.3 2017/07/06 00:08:52 schwarze Exp $ +.Dd $Mdocdate: July 6 2017 $ .Dt UNARY-DIACRIT 1 .Os .Sh NAME @@ -10,5 +10,6 @@ initial text .EQ x dot x dotdot x hat x tilde x vec x dyad { x + y } bar { x + y } under +x tilde hat .EN final text diff --git a/regress/usr.bin/mandoc/eqn/unary/diacrit.out_ascii b/regress/usr.bin/mandoc/eqn/unary/diacrit.out_ascii index f2c5b0bbf8d..5cc40fe3da8 100644 --- a/regress/usr.bin/mandoc/eqn/unary/diacrit.out_ascii +++ b/regress/usr.bin/mandoc/eqn/unary/diacrit.out_ascii @@ -4,6 +4,6 @@ NNAAMMEE uunnaarryy--ddiiaaccrriitt - diacritical marks in equations DDEESSCCRRIIPPTTIIOONN - initial text _x. _x" _x^ _x~ _x-> _x<-> (_x + _y) (_x + _y)_ final text + initial text _x. _x" _x^ _x~ _x-> _x<-> (_x + _y) (_x + _y)_ _x~^ final text -OpenBSD July 4, 2017 OpenBSD +OpenBSD July 5, 2017 OpenBSD diff --git a/regress/usr.bin/mandoc/eqn/unary/diacrit.out_html b/regress/usr.bin/mandoc/eqn/unary/diacrit.out_html index 02dcc2f4911..d3d4d3613af 100644 --- a/regress/usr.bin/mandoc/eqn/unary/diacrit.out_html +++ b/regress/usr.bin/mandoc/eqn/unary/diacrit.out_html @@ -1 +1 @@ -<mrow><mover><mi>x</mi><mo>˙</mo></mover><mover><mi>x</mi><mo>¨</mo></mover><mover><mi>x</mi><mo>^</mo></mover><mover><mi>x</mi><mo>~</mo></mover><mover><mi>x</mi><mo>→</mo></mover><mover><mi>x</mi><mo>↔</mo></mover><mover><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mo></mo></mover><munder><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mo>_</mo></munder></mrow> +<mrow><mover><mi>x</mi><mo>˙</mo></mover><mover><mi>x</mi><mo>¨</mo></mover><mover><mi>x</mi><mo>^</mo></mover><mover><mi>x</mi><mo>~</mo></mover><mover><mi>x</mi><mo>→</mo></mover><mover><mi>x</mi><mo>↔</mo></mover><mover><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mo></mo></mover><munder><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mo>_</mo></munder><mover><mover><mi>x</mi><mo>~</mo></mover><mo>^</mo></mover></mrow> diff --git a/regress/usr.bin/mandoc/eqn/unary/sqrt.in b/regress/usr.bin/mandoc/eqn/unary/sqrt.in index a7059624257..e007ff01739 100644 --- a/regress/usr.bin/mandoc/eqn/unary/sqrt.in +++ b/regress/usr.bin/mandoc/eqn/unary/sqrt.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: sqrt.in,v 1.4 2017/07/04 14:53:23 schwarze Exp $ -.Dd $Mdocdate: July 4 2017 $ +.\" $OpenBSD: sqrt.in,v 1.5 2017/07/06 00:08:52 schwarze Exp $ +.Dd $Mdocdate: July 6 2017 $ .Dt UNARY-SQRT 1 .Os .Sh NAME @@ -8,6 +8,6 @@ .Sh DESCRIPTION initial text .EQ -r = sqrt { x sup 2 + y sup 2 } + sqrt a+b + sqrt { } + sqrt +r = sqrt { x sup 2 + y sup 2 } + sqrt a+b + sqrt x hat + sqrt { } + sqrt .EN final text diff --git a/regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii b/regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii index 607a6013aa3..c8565529fc0 100644 --- a/regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii +++ b/regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii @@ -4,6 +4,7 @@ NNAAMMEE uunnaarryy--ssqqrrtt - square root DDEESSCCRRIIPPTTIIOONN - initial text _r = sqrt(_x^2 + _y^2) + sqrt(_a + _b) + sqrt() + sqrt final text + initial text _r = sqrt(_x^2 + _y^2) + sqrt(_a + _b) + sqrt(_x^) + sqrt() + sqrt + final text -OpenBSD July 4, 2017 OpenBSD +OpenBSD July 5, 2017 OpenBSD diff --git a/regress/usr.bin/mandoc/eqn/unary/sqrt.out_html b/regress/usr.bin/mandoc/eqn/unary/sqrt.out_html index ca2de199e98..0b5fe37e1d5 100644 --- a/regress/usr.bin/mandoc/eqn/unary/sqrt.out_html +++ b/regress/usr.bin/mandoc/eqn/unary/sqrt.out_html @@ -1 +1 @@ -<mrow><mi>r</mi><mo>=</mo><msqrt><mrow><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><msup><mi>y</mi><mn>2</mn></msup></mrow></msqrt><mo>+</mo><msqrt><mrow><mi>a</mi><mo>+</mo><mi>b</mi></mrow></msqrt><mo>+</mo><msqrt><mrow></mrow></msqrt><mo>+</mo><msqrt></msqrt></mrow> +<mrow><mi>r</mi><mo>=</mo><msqrt><mrow><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><msup><mi>y</mi><mn>2</mn></msup></mrow></msqrt><mo>+</mo><msqrt><mrow><mi>a</mi><mo>+</mo><mi>b</mi></mrow></msqrt><mo>+</mo><msqrt><mover><mi>x</mi><mo>^</mo></mover></msqrt><mo>+</mo><msqrt><mrow></mrow></msqrt><mo>+</mo><msqrt></msqrt></mrow> |