bugGNU Octave - Bugs: bug #56121, teach lexer to recognize...

 
 

bug #56121: teach lexer to recognize "SPDX-License-Identifier" tag as a copyright comment

Submitter:  Mike Miller <mtmiller>
Submitted:  Thu 11 Apr 2019 06:21:17 PM UTC
   
 
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  mtmiller
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 10 May 2019 07:48:35 PM UTC, comment #3: 

Pushed this change on the default branch

https://hg.savannah.gnu.org/hgweb/octave/rev/007fcab79721

This could certainly be extended in the future to allow the user to specify all kinds of markers for the parser to skip leading comment blocks, but this is good for me for now.

Mike Miller <mtmiller>
Group Member
Thu 11 Apr 2019 10:24:31 PM UTC, comment #2: 

I'm OK with accepting additional ways to recognize a comment block as a copyright notice instead of help text.  Maybe we should use a regexp and allow it to be configurable in some way?

John W. Eaton <jwe>
Group administrator
Thu 11 Apr 2019 06:23:43 PM UTC, comment #1: 

Patch attached.

(file #46750)

Mike Miller <mtmiller>
Group Member
Thu 11 Apr 2019 06:21:17 PM UTC, original submission:  

The "SPDX-License-Identifier" tag is an attempt to create a machine-readable standardized way to mark the license of a source file. Typically this identifier is the first comment line in a source file, script, or data file.

https://spdx.org/using-spdx-license-identifier

Octave's lexer currently looks for the words "Author" or "Copyright" as the first word in a comment block. I would like to add support for "SPDX-License-Identifier" to serve the same purpose. I will submit an already-tested patch once I have a bug number. This patch will allow a function file that looks like this to work correctly:


## SPDX-License-Identifier: MIT
## Copyright (C) 2019 Mike Miller

## -*- texinfo -*-
## @deftypefn {} {} hello
## Print a hello world message.
## @end deftypefn

function hello ()
  disp ("Hello, world!")
endfunction


Without this patch, the 'help' function does not find the doc string correctly, the user is forced to reorder the first two lines to put the "Copyright" line first.

Mike Miller <mtmiller>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #46750:  spdx.patch added by mtmiller (920B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-10 mtmiller StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2019-04-11 mtmiller Attached File- Added spdx.patch, #46750
        StatusNone Patch Submitted
    2019-04-11 mtmiller Carbon-CopyRemoved 80942 -

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code