Macaulay2 / M2-emacs

Macaulay2 emacs files
GNU General Public License v3.0
5 stars 3 forks source link

Don't match filenames with opening bracket in regex #50

Closed d-torrance closed 8 months ago

d-torrance commented 10 months ago

Filenames are frequently surrounded by square brackets because of net(Function). We were omitting the opening square bracket from the regex in one of the three cases, but not all, which was leading to some incorrect behavior.


This fixes the issue I mentioned in https://github.com/Macaulay2/M2/pull/3026#issue-2025171322 . In particular, consider the code below:

i1 : x -> x

o1 = -*Function[stdio:1:2-1:5]*-

o1 : FunctionClosure

Currently, the second regex (which already doesn't allow [) matches stdio:1:2-1:5, but sees that the filename is stdio, which is blacklisted, so we move to the third regex (which has been allowing [), and that thinks that the filename is -*Function[stdio, which is obviously incorrect.

So we omit [ from the third regex (which is for DocumentTag locations that don't have an ending line/column number), and even though it probably won't matter, from the first regex (for error messages), too.