Skip to content

Commit

Permalink
Add GNU style link 'r-c.ce', 'r.c-re.ce'
Browse files Browse the repository at this point in the history
See https://www.gnu.org/prep/standards/html_node/Errors.html

sourcefile:line1.column1-line2.column2: message
sourcefile:line1.column1-column2: message
sourcefile:line1-line2: message

Fixes #190350
  • Loading branch information
Tyriar committed Aug 29, 2023
1 parent 07a6890 commit fdb265d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ function generateLinkSuffixRegex(eolOnly: boolean) {

// The comments in the regex below use real strings/numbers for better readability, here's
// the legend:
// - Path = foo
// - Row = 339
// - Col = 12
// - Path = foo
// - Row = 339
// - Col = 12
// - RowEnd = 341
// - ColEnd = 14
//
// These all support single quote ' in the place of " and [] in the place of ()
const lineAndColumnRegexClauses = [
Expand All @@ -78,7 +80,9 @@ function generateLinkSuffixRegex(eolOnly: boolean) {
// "foo",339
// "foo",339:12
// "foo",339.12
`(?::| |['"],)${r()}([:.]${c()})?` + eolSuffix,
// "foo",339.12-14
// "foo",339.12-341.14
`(?::| |['"],)${r()}([:.]${c()}(?:-(?:${re()}\.)?${ce()})?)?` + eolSuffix,
// The quotes below are optional [#171652]
// "foo", line 339 [#40468]
// "foo", line 339, col 12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const testLinks: ITestLink[] = [
{ link: 'foo 339', prefix: undefined, suffix: ' 339', hasRow: true, hasCol: false },
{ link: 'foo 339:12', prefix: undefined, suffix: ' 339:12', hasRow: true, hasCol: true },
{ link: 'foo 339.12', prefix: undefined, suffix: ' 339.12', hasRow: true, hasCol: true },
{ link: 'foo 339.12-14', prefix: undefined, suffix: ' 339.12-14', hasRow: true, hasCol: true, hasRowEnd: false, hasColEnd: true },
{ link: 'foo 339.12-341.14', prefix: undefined, suffix: ' 339.12-341.14', hasRow: true, hasCol: true, hasRowEnd: true, hasColEnd: true },

// Double quotes
{ link: '"foo",339', prefix: '"', suffix: '",339', hasRow: true, hasCol: false },
Expand Down

0 comments on commit fdb265d

Please sign in to comment.