Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nasty edge cases #9

Open
mmcloughlin opened this issue Feb 5, 2020 · 1 comment
Open

nasty edge cases #9

mmcloughlin opened this issue Feb 5, 2020 · 1 comment

Comments

@mmcloughlin
Copy link
Owner

mmcloughlin commented Feb 5, 2020

Collection of edge cases that are not handled well. See also #3.

Chained super/subscripts:
For example in x/crypto/pkcs12:

	//       Z_2^u x Z_2^v -> Z_2^u

https://github.com/golang/crypto/blob/c9f3fb736b729628ec1e9c1a6b4313e883f452f9/pkcs12/pbkdf.go#L38

Punctuation prior:
For example:

		//        A.  Set A2=H^r(D||I). (i.e., the r-th hash of D||1,

https://github.com/golang/crypto/blob/c9f3fb736b729628ec1e9c1a6b4313e883f452f9/pkcs12/pbkdf.go#L108

Tables:
In the below, the -+ gets replaced with a "MINUS-PLUS" symbol.

//	                  |  USTAR |       PAX |       GNU
//	------------------+--------+-----------+----------
//	Name              |   256B | unlimited | unlimited
//	Linkname          |   100B | unlimited | unlimited

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/archive/tar/format.go#L19-L22

Channel syntax:
Source code in a comment replaced with a unicode arrow.

//	x, ok := <-c

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/builtin/buil
tin.go#L218

Quoted strings:

	// R1 op R2 or r1 op constant.
	// op is:
	//	"<<" == 0
	//	">>" == 1
	//	"->" == 2
	//	"@>" == 3

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/cmd/asm/internal/asm/parse.go#L610-L615

Comment dividers:

// The original C code, the long comment, and the constants
// below are from FreeBSD's /usr/src/lib/msun/src/s_log1p.c
// and came with this notice. The go code is a simplified
// version of the original C.
//
// ====================================================
// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
//
// Developed at SunPro, a Sun Microsystems, Inc. business.
// Permission to use, copy, modify, and distribute this
// software is freely granted, provided that this notice
// is preserved.
// ====================================================

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/math/log1p.go#L7-L19

Windows filepaths:
Can be interpreted as LaTeX symbols:

//   * UNC paths                              (e.g \\server\share\foo\bar)
//   * absolute paths                         (e.g C:\foo\bar)
//   * relative paths begin with drive letter (e.g C:foo\bar, C:..\foo\bar, C:.., C:.)
//   * relative paths begin with '\'          (e.g \foo\bar)
//   * relative paths begin without '\'       (e.g foo\bar, ..\foo\bar, .., .)

https://github.com/golang/go/blob/f770366f6d910e4bf92a6f885908afe134d65b23/src/path/filepath/symlink_windows.go#L52-L56

@mmcloughlin mmcloughlin changed the title edge case handling nasty edge cases Feb 5, 2020
mmcloughlin added a commit that referenced this issue Feb 5, 2020
Some cases are a bit nasty. Punt for now. Recorded in #9 to return to.

Updates #9
mmcloughlin added a commit that referenced this issue Feb 5, 2020
Some cases are a bit nasty. Punt for now. Recorded in #9 to return to.

Updates #9
mmcloughlin added a commit that referenced this issue Feb 5, 2020
Running mathfmt over x/crypto revealed a bunch of problematic cases. This PR reimplements formula processing with regular expressions, enabling more complex logic to be easily expressed. Overall this greatly simplified everything -- I wish I'd done it this way at first!

Updates #3 #9
@mmcloughlin
Copy link
Owner Author

Seems many of the standard library changes come from the symbol aliases. Perhaps these could be replaced with less common strings.

mmcloughlin added a commit that referenced this issue Feb 5, 2020
Makes changes as a result of running over the standard library. Changes
some aliases to less common sequences. Adds test cases.

Updates #3 #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant