Opened 8 years ago

Last modified 5 years ago

#145 closed defect

lex_string_ builds comment descriptors with incorrect back-threads — at Version 1

Reported by: Gary Dixon Owned by: Gary Dixon
Priority: minor Milestone: MR12.7
Component: Tools Version: MR12.6f
Keywords: Cc:

Description (last modified by Gary Dixon)

The lex_string_$lex entrypoint incorrectly sets the comment.Plast pointer to point to the current comment descriptor, rather than to its predecessor. This bug prevents walking backward through the comments found in a lexed input string.

Also, several of the PL/I comments in the lex_string_.pl1 code are either misleading or inadequate. These make the code harder to read/understand.

I suggest the following changes to repair the comment.Plast bug, and enhance the code comments.

cpa [lpn lex_string_.pl1] ==

A580                     comment.Pnext -> comment.Plast = **comment.Pnext**;
Changed by B to:
B580                     comment.Pnext -> comment.Plast =** Pcomment**;


A616                /*     and doubled quotes are _\010n_\010o_\010t being retained, copy the quoted          */
Changed by B to:
B616                /*     and doubled quotes are NOT being retained, copy the quoted     */


A804                     stmt.Lvalue = min(max_Lvalue, stmt.Lvalue - Lstr);
Changed by B to:
B804                          /* Set actual length of prior stmt.                         */
B805                     stmt.Lvalue = min(max_Lvalue, stmt.Lvalue - Lstr);
B806                          /* If prior statement ended on current line, increment the  */
B807                          /* statement-in-line counter (to be used in new stmt).      */


Inserted in B:
B812      
Preceding:
A809                     stmt.Pnext = allocate (Parea, size(stmt));


A842                /*     If a used token already exists, reuse it.                      */
Changed by B to:
B846                /*     If just-prior token was "unmade", reuse the token descriptor.  */


Inserted in B:
B863                          /* Allocate a new token descriptor.                         */
Preceding:
A859                     if APtoken = null then do;

Comparison finished: 6 differences, 13 lines.

Change History (1)

comment:1 by Gary Dixon, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.