From rybin@possum.srcc.msu.su Tue Feb 24 14:16:24 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id OAA17182; Tue, 24 Feb 1998 14:16:23 -0500 Received: from mail.acm.org (mail.acm.org [199.222.69.4]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id OAA00578 for ; Tue, 24 Feb 1998 14:17:39 -0500 (EST) Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us [199.75.54.2]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id OAA47746; Tue, 24 Feb 1998 14:15:27 -0500 Received: from gw-srcc.gamma.ru by sw-eng.falls-church.va.us (8.8.8/) id TAA19868; Tue, 24 Feb 1998 19:11:40 GMT Received: from srcc.UUCP (uucp@localhost) by gw-srcc.gamma.ru (8.8.5/8.8.5) with UUCP id WAA11318 for asis-comment@sw-eng.falls-church.va.us; Tue, 24 Feb 1998 22:14:59 +0300 (MSK) Received: by gamma.srcc.msu.su; Tue, 24 Feb 1998 22:13:31 +0300 Received: by possum.srcc.msu.su (UUPC/@ v5.09gamma, 14Mar93); Tue, 24 Feb 1998 22:16:22 +0300 To: asis-comment@sw-eng.falls-church.va.us Message-Id: Organization: Information Systems, SRCC, MSU From: "Sergey I. Rybin" Date: Tue, 24 Feb 98 22:16:22 +0300 X-Mailer: BML [MS/DOS Beauty Mail v.1.36] Subject: Nil_Line and a line with zero length - are they the same thing? Lines: 53 Content-Length: 1813 Status: OR Asis.Text says: --------------------------------------------------------------------------------------- -- 20.1 type Line --------------------------------------------------------------------------------------- -- An Ada text line abstraction (a private type). -- -- Used to represent text fragments from a compilation. -- ASIS Lines are representations of the compilation text. -- This shall be supported by all ASIS implementations. --------------------------------------------------------------------------------------- type Line is private; Nil_Line : constant Line; And then: --------------------------------------------------------------------------------------- -- 20.13 function Is_Nil --------------------------------------------------------------------------------------- function Is_Nil (Right : in Line) return Boolean; --------------------------------------------------------------------------------------- -- Right - Specifies the line to check -- -- Returns True if the argument is the Nil_Line. -- The question is: suppose in a program text we have something like this: begin X := X + 1; where indicates end-of-line as it is used in the underlying system. this means that the second line in this example should (or may?) map onto an ASIS Line having the zero length. And now the question - should this zero-length Line test Is_Nil? I think it should not, becuase Nil_Line, in my opinion, is supposed to be used as a special nil value to mark non-initialized objects of the Line type. That is, that is some kind of an abstract nil value, whereas a line having the length of zero is just a line from a source having an empty text image. Is this interpretation correct? I would clarify this in the ASIS definition anyway Sergey. From roby Thu Mar 26 17:33:36 1998 Return-Path: Received: by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id RAA07224; Thu, 26 Mar 1998 17:33:35 -0500 From: roby (Clyde Roby) Message-Id: <199803262233.RAA07224@cronus.csed.ida.org> Subject: Nil_Line and a line with zero length - are they the same thing? To: SBlake@Aonix.Com (Steve Blake) Date: Thu, 26 Mar 1998 17:33:34 -0500 (EST) Cc: roby (Clyde Roby) X-Mailer: ELM [version 2.5 PL0b2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Length: 2763 Status: OR Steve, Perhaps you can recall the history on Nil_Line and Is_Nil? On first glance, I was going to agree with Sergey, but then what would be the use of an "unitialized_line" value as he suggests Nil_Line is? Now, I tend to think that Nil_Line is equivalent logically to an empty string / empty Line. Either way, we obviously need to make it clearer, as Sergey suggests. Clyde Forwarded message: > From rybin@possum.srcc.msu.su Tue Feb 24 14:16:24 1998 > To: asis-comment@sw-eng.falls-church.va.us > Message-Id: > Organization: Information Systems, SRCC, MSU > From: "Sergey I. Rybin" > Date: Tue, 24 Feb 98 22:16:22 +0300 > X-Mailer: BML [MS/DOS Beauty Mail v.1.36] > Subject: Nil_Line and a line with zero length - are they the same thing? > Lines: 53 > Content-Length: 1813 > > Asis.Text says: > > --------------------------------------------------------------------------------------- > -- 20.1 type Line > --------------------------------------------------------------------------------------- > -- An Ada text line abstraction (a private type). > -- > -- Used to represent text fragments from a compilation. > -- ASIS Lines are representations of the compilation text. > -- This shall be supported by all ASIS implementations. > --------------------------------------------------------------------------------------- > > type Line is private; > Nil_Line : constant Line; > > And then: > > --------------------------------------------------------------------------------------- > -- 20.13 function Is_Nil > --------------------------------------------------------------------------------------- > > function Is_Nil (Right : in Line) > return Boolean; > > --------------------------------------------------------------------------------------- > -- Right - Specifies the line to check > -- > -- Returns True if the argument is the Nil_Line. > -- > > The question is: suppose in a program text we have something like this: > > begin > > X := X + 1; > > where indicates end-of-line as it is used in the underlying system. > this means that the second line in this example should (or may?) map > onto an ASIS Line having the zero length. > > And now the question - should this zero-length Line test Is_Nil? > > I think it should not, becuase Nil_Line, in my opinion, is supposed to > be used as a special nil value to mark non-initialized objects of the > Line type. That is, that is some kind of an abstract nil value, whereas > a line having the length of zero is just a line from a source having > an empty text image. > > Is this interpretation correct? > > I would clarify this in the ASIS definition anyway > > Sergey. From sblake@sd.aonix.com Thu Mar 26 22:17:07 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id WAA07490; Thu, 26 Mar 1998 22:17:06 -0500 Received: from gw.sd.aonix.com (gw.alsys.com [136.175.17.2]) by cs.ida.org (8.8.7/8.8.7) with SMTP id WAA01051 for ; Thu, 26 Mar 1998 22:18:22 -0500 (EST) Received: from rasht.sd.aonix.com (mailhub.alsys.com) by gw.sd.aonix.com (4.1/SMI-4.1.1) id AA09042; Thu, 26 Mar 98 19:17:10 PST Received: from puumba.telesoft by rasht.sd.aonix.com (4.1/TS-1.2c) id AA19207; Thu, 26 Mar 98 19:15:03 PST Received: by puumba.telesoft (SMI-8.6/SMI-SVR4) id TAA17388; Thu, 26 Mar 1998 19:15:02 -0800 Date: Thu, 26 Mar 1998 19:15:02 -0800 From: sblake@sd.aonix.com (Steve Blake @pulsar) Message-Id: <199803270315.TAA17388@puumba.telesoft> To: SBlake@aonix.com, roby@ida.org Subject: Re: Nil_Line and a line with zero length - are they the same thing? Content-Length: 150 Status: ORr Clyde, I agree with Sergey that a zero length line should not test Is_Nil. It is a valid line value rather than an uninitialized Is_Nil value. Steve From roby Fri Mar 27 12:11:15 1998 Return-Path: Received: by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id MAA08764; Fri, 27 Mar 1998 12:11:14 -0500 From: roby (Clyde Roby) Message-Id: <199803271711.MAA08764@cronus.csed.ida.org> Subject: Re: Nil_Line and a line with zero length - are they the same thing? To: sblake@sd.aonix.com (Steve Blake @pulsar) Date: Fri, 27 Mar 1998 12:11:14 -0500 (EST) Cc: roby (Clyde Roby) In-Reply-To: <199803270315.TAA17388@puumba.telesoft> from "Steve Blake @pulsar" at Mar 26, 1998 07:15:02 PM X-Mailer: ELM [version 2.5 PL0b2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Length: 560 Status: OR Steve, > Clyde, I agree with Sergey that a zero length line should not test Is_Nil. > It is a valid line value rather than an uninitialized Is_Nil value. Do you have a copy of section 20 of ASIS (package ASIS.Text)? If so, could you please suggest some wording at appropriate places (definition of type Line, definition of Nil_Line, description of interfaces Is_Nil and perhaps others) to clarify the intent of Is_Nil and/or Nil_Line? The text version of ASIS.Text is available at the ASIS web site; otherwise, I can email it to you. Thanks again. Clyde From sblake@sd.aonix.com Fri Mar 27 12:20:42 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id MAA08793; Fri, 27 Mar 1998 12:20:41 -0500 Received: from gw.sd.aonix.com (gw.alsys.com [136.175.17.2]) by cs.ida.org (8.8.7/8.8.7) with SMTP id MAA12961 for ; Fri, 27 Mar 1998 12:21:56 -0500 (EST) Received: from rasht.sd.aonix.com (mailhub.alsys.com) by gw.sd.aonix.com (4.1/SMI-4.1.1) id AA21861; Fri, 27 Mar 98 09:20:54 PST Received: from puumba.telesoft by rasht.sd.aonix.com (4.1/TS-1.2c) id AA26017; Fri, 27 Mar 98 09:18:47 PST Received: by puumba.telesoft (SMI-8.6/SMI-SVR4) id JAA22621; Fri, 27 Mar 1998 09:18:46 -0800 Date: Fri, 27 Mar 1998 09:18:46 -0800 From: sblake@sd.aonix.com (Steve Blake @pulsar) Message-Id: <199803271718.JAA22621@puumba.telesoft> To: roby@ida.org Subject: Re: Nil_Line and a line with zero length - are they the same thing? Content-Length: 122 Status: ORr Clyde, I'll pick up the latest ASIS version; I've been meaning to anyway. I'll get back to you with some wording. Steve From roby Fri Mar 27 12:26:29 1998 Return-Path: Received: by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id MAA08817; Fri, 27 Mar 1998 12:26:28 -0500 From: roby (Clyde Roby) Message-Id: <199803271726.MAA08817@cronus.csed.ida.org> Subject: Re: Nil_Line and a line with zero length - are they the same thing? To: sblake@sd.aonix.com (Steve Blake @pulsar) Date: Fri, 27 Mar 1998 12:26:28 -0500 (EST) Cc: roby (Clyde Roby) In-Reply-To: <199803271718.JAA22621@puumba.telesoft> from "Steve Blake @pulsar" at Mar 27, 1998 09:18:46 AM X-Mailer: ELM [version 2.5 PL0b2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Length: 152 Status: OR > Clyde, I'll pick up the latest ASIS version; I've been meaning to anyway. > > I'll get back to you with some wording. Great! Thanks again. Clyde From roby Mon Apr 6 18:00:49 1998 Return-Path: Received: by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id SAA28599; Mon, 6 Apr 1998 18:00:48 -0400 From: roby (Clyde Roby) Message-Id: <199804062200.SAA28599@cronus.csed.ida.org> Subject: Issue #093, thoughts To: SBlake@Aonix.Com (Steve Blake), Rybin@GNAT.Com (Sergey Rybin) Date: Mon, 6 Apr 1998 18:00:48 -0400 (EDT) Cc: Colket@ACM.Org (Currie Colket at ACM), roby (Clyde Roby) X-Mailer: ELM [version 2.5 PL0b2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Length: 1715 Status: OR Steve and Sergey, On Sergey's I093, "Nil_Line equal line with zero length," Clyde sent an email to Steve requesting suggestions for issue resolution. Steve replied: > Clyde, here is some simple clarification. I think too much > will be overkill. My comments are marked ">>" > The comments mean that Nil_Line is only a value for uninitialized > Line variables. Attempts to give Is_Nil line arguments to the > functions Length, Line_Image, Comment_Image, and > Non_Comment_Image should raise ASIS_Inappropriate_Line. > Let me know if your agree. We have been discussing the need for making a distinction in the ASIS specification. Yes, we recognize that there will be a difference in representation on the implementation side; A Nil_Line could be either a null pointer or a zero length string. Should this make a difference on the application side? Regardless of how different implementations represent lines with no content, why shouldn't the application be able to view a Nil_Line as a zero-length line? The solution that Steve provides above could result in a lot of exception handling for an ASIS application when there are uninitialized lines in the middle of program text. This does not seem like a very friendly way to implement Nil_Line. Perhaps an ASIS application friendly way is to add the following after its definition: -- Nil_Line is the value of an uninitialized Line object. -- On the application side, it should be viewed as a zero-length line. And comment for Length: -- Returns "0" if Nil_Line(The_Line). And comment for Line_Image, Comment_Image, and Non-Comment_Image: -- Returns the image equivalent for a zero-length line if Is_Nil(The_Line). Thoughts? v/r Currie and Clyde From sblake@sd.aonix.com Tue Apr 14 13:00:58 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id NAA14379; Tue, 14 Apr 1998 13:00:53 -0400 Received: from gw.sd.aonix.com (gw.alsys.com [136.175.17.2]) by cs.ida.org (8.8.7/8.8.7) with SMTP id NAA21660 for ; Tue, 14 Apr 1998 13:02:11 -0400 (EDT) Received: from rasht.sd.aonix.com (mailhub.alsys.com) by gw.sd.aonix.com (4.1/SMI-4.1.1) id AA01162; Tue, 14 Apr 98 10:00:18 PDT Received: from puumba.telesoft by rasht.sd.aonix.com (4.1/TS-1.2c) id AA05051; Tue, 14 Apr 98 09:57:59 PDT Received: by puumba.telesoft (SMI-8.6/SMI-SVR4) id JAA18375; Tue, 14 Apr 1998 09:57:58 -0700 Date: Tue, 14 Apr 1998 09:57:58 -0700 From: sblake@sd.aonix.com (Steve Blake @pulsar) Message-Id: <199804141657.JAA18375@puumba.telesoft> To: Rybin@GNAT.Com, SBlake@aonix.com, roby@ida.org Subject: Re: Issue #093, thoughts Cc: Colket@ACM.Org Content-Length: 2966 Status: OR >From roby@ida.org Mon Apr 6 15:02:57 1998 >Subject: Issue #093, thoughts >To: SBlake@aonix.com (Steve Blake), Rybin@GNAT.Com (Sergey Rybin) >Cc: Colket@ACM.Org (Currie Colket at ACM), roby@ida.org (Clyde Roby) >Mime-Version: 1.0 >Content-Transfer-Encoding: 7bit > >Steve and Sergey, > >On Sergey's I093, "Nil_Line equal line with zero length," Clyde sent >an email to Steve requesting suggestions for issue resolution. Steve >replied: > >> Clyde, here is some simple clarification. I think too much >> will be overkill. My comments are marked ">>" > >> The comments mean that Nil_Line is only a value for uninitialized >> Line variables. Attempts to give Is_Nil line arguments to the >> functions Length, Line_Image, Comment_Image, and >> Non_Comment_Image should raise ASIS_Inappropriate_Line. > >> Let me know if your agree. > >We have been discussing the need for making a distinction in the ASIS >specification. Yes, we recognize that there will be a difference in >representation on the implementation side; A Nil_Line could be either >a null pointer or a zero length string. Should this make a difference >on the application side? Regardless of how different implementations >represent lines with no content, why shouldn't the application be able >to view a Nil_Line as a zero-length line? The solution that Steve >provides above could result in a lot of exception handling for an ASIS >application when there are uninitialized lines in the middle of >program text. This does not seem like a very friendly way to implement >Nil_Line. Let me attempt to make this a bit clearer. This solution is consistent with the rest of ASIS; if any nil value of all other abstractions is passed to queries inappropriately, then an exception is raised. There should never be uninitialized lines in the middle of program text. Blank lines returned from any of the Lines functions are initialized, they just have a length of zero and nil string images. They should not cause exceptions and they are not equal to Nil_Line. This is very friendly to the application: There is little or no need to test Is_Nil on line values returned by the Lines functions. There is a clear distinction between Nil_Line and blank lines of program text. The actual implementation of Nil_Line should be of no consequence on the application side. > >Perhaps an ASIS application friendly way is to add the following after >its definition: > >-- Nil_Line is the value of an uninitialized Line object. >-- On the application side, it should be viewed as a zero-length line. > >And comment for Length: > >-- Returns "0" if Nil_Line(The_Line). > >And comment for Line_Image, Comment_Image, and Non-Comment_Image: > >-- Returns the image equivalent for a zero-length line if Is_Nil(The_Line). > >Thoughts? I think this is a departure from the paradigm used throughout ASIS. If we did this, would there ever be a use for ASIS_Inappropriate_Line? Steve > >v/r >Currie and Clyde From sblake@sd.aonix.com Wed Apr 1 18:48:13 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id SAA17630; Wed, 1 Apr 1998 18:48:12 -0500 Received: from gw.sd.aonix.com (gw.alsys.com [136.175.17.2]) by cs.ida.org (8.8.7/8.8.7) with SMTP id SAA23180 for ; Wed, 1 Apr 1998 18:49:29 -0500 (EST) Received: from rasht.sd.aonix.com (mailhub.alsys.com) by gw.sd.aonix.com (4.1/SMI-4.1.1) id AA21494; Wed, 1 Apr 98 15:48:26 PST Received: from simba.telesoft by rasht.sd.aonix.com (4.1/TS-1.2c) id AA10339; Wed, 1 Apr 98 15:46:16 PST Received: by simba.telesoft (SMI-8.6/SMI-SVR4) id PAA08114; Wed, 1 Apr 1998 15:46:14 -0800 Date: Wed, 1 Apr 1998 15:46:14 -0800 From: sblake@sd.aonix.com (Steve Blake @pulsar) Message-Id: <199804012346.PAA08114@simba.telesoft> To: roby@ida.org Subject: Asis.Text comment additions Content-Length: 28938 Status: OR Clyde, here is some simple clarification. I think too much will be overkill. My comments are marked ">>" The comments mean that Nil_Line is only a value for uninitialized Line variables. Attempts to give Is_Nil line arguments to the functions Length, Line_Image, Comment_Image, and Non_Comment_Image should raise ASIS_Inappropriate_Line. Let me know if your agree. Steve :Do you have a copy of section 20 of ASIS (package ASIS.Text)? If so, :could you please suggest some wording at appropriate places :(definition of type Line, definition of Nil_Line, description of :interfaces Is_Nil and perhaps others) to clarify the intent of Is_Nil :and/or Nil_Line? The text version of ASIS.Text is available at the :ASIS web site; otherwise, I can email it to you. package Asis.Text is --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- -- Asis.Text -- -- This package encapsulates a set of operations to access the text of ASIS -- Elements. It assumes no knowledge of the existence, location, or form of -- the program text. -- -- The text of a program consists of the texts of one or more compilations. -- The text of each compilation is a sequence of separate lexical elements. -- Each lexical element is either a delimiter, an identifier (which can be a -- reserved word), a numeric literal, a character literal, a string literal, -- blank space, or a comment. -- -- Each ASIS Element has a text image whose value is the series of characters -- contained by the text span of the Element. The text span covers all the -- characters from the first character of the Element through the last -- character of the Element over some range of lines. -- -- General Usage Rules: -- -- Line lists can be indexed to obtain individual lines. The bounds of each -- list correspond to the lines with those same numbers from the compilation -- text. -- -- Any Asis.Text query may raise ASIS_Failed with a Status of Text_Error if -- the program text cannot be located or retrieved for any reason such as -- renaming, deletion, corruption, or moving of the text. --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- -- 20.1 type Line --------------------------------------------------------------------------------------- -- An Ada text line abstraction (a private type). -- -- Used to represent text fragments from a compilation. -- ASIS Lines are representations of the compilation text. -- This shall be supported by all ASIS implementations. --------------------------------------------------------------------------------------- type Line is private; Nil_Line : constant Line; >> Add 1 line: -- Nil_Line is the value of an uninitialized Line object. --------------------------------------------------------------------------------------- -- 20.2 type Line_Number --------------------------------------------------------------------------------------- -- Line_Number -- -- A numeric subtype that allows each ASIS implementation to place constraints -- on the upper bound for Line_List elements and compilation unit size. -- -- The upper bound of Line_Number (Maximum_Line_Number) is the only -- allowed variation for these declarations. -- -- Line_Number = 0 is reserved to act as an "invalid" Line_Number value. No -- unit text line will ever have a Line_Number of zero. --------------------------------------------------------------------------------------- -- Line shall be an undiscriminated private type, or, shall be derived from an -- undiscriminated private type. It can be declared as a new type or as a -- subtype of an existing type. --------------------------------------------------------------------------------------- Maximum_Line_Number : constant ASIS_Natural := Implementation_Defined_Integer_Constant; subtype Line_Number is ASIS_Natural range 0 .. Maximum_Line_Number; --------------------------------------------------------------------------------------- -- 20.3 type Line_Number_Positive --------------------------------------------------------------------------------------- subtype Line_Number_Positive is Line_Number range 1 .. Maximum_Line_Number; --------------------------------------------------------------------------------------- -- 20.4 type Line_List --------------------------------------------------------------------------------------- type Line_List is array (Line_Number_Positive range <>) of Line; Nil_Line_List : constant Line_List; --------------------------------------------------------------------------------------- -- 20.5 type Character_Position --------------------------------------------------------------------------------------- -- Character_Position -- -- A numeric subtype that allows each ASIS implementation to place constraints -- on the upper bound for Character_Position and for compilation unit line -- lengths. -- -- The upper bound of Character_Position (Maximum_Line_Length) is the -- only allowed variation for these declarations. -- -- Character_Position = 0 is reserved to act as an "invalid" -- Character_Position value. No unit text line will ever have a character in -- position zero. --------------------------------------------------------------------------------------- Maximum_Line_Length : constant ASIS_Natural := Implementation_Defined_Integer_Constant; subtype Character_Position is ASIS_Natural range 0 .. Maximum_Line_Length; --------------------------------------------------------------------------------------- -- 20.6 type Character_Position_Positive --------------------------------------------------------------------------------------- subtype Character_Position_Positive is Character_Position range 1 .. Maximum_Line_Length; --------------------------------------------------------------------------------------- -- 20.7 type Span --------------------------------------------------------------------------------------- -- Span -- -- A single text position is identified by a line number and a column number, -- that represent the text's position within the compilation unit. -- -- The text of an element can span one or more lines. The textual Span of an -- element identifies the lower and upper bound of a span of text positions. -- -- Spans and positions give client tools the option of accessing compilation -- unit text through the queries provided by this package, or, to access -- the text directly through the original compilation unit text file. Type span -- facilitates the capture of comments before or after an element. -- -- Note: The original compilation unit text may or may not have existed in a -- "file", and any such file may or may not still exist. Reference Manual 10.1 -- specifies that the text of a compilation unit is submitted to a compiler. It -- does not specify that the text is stored in a "file", nor does it specify that -- the text of a compilation unit has any particular lifetime. --------------------------------------------------------------------------------------- type Span is -- Default is Nil_Span record First_Line : Line_Number_Positive := 1; -- 1..0 - empty First_Column : Character_Position_Positive := 1; -- 1..0 - empty Last_Line : Line_Number := 0; Last_Column : Character_Position := 0; end record; Nil_Span : constant Span := (First_Line => 1, First_Column => 1, Last_Line => 0, Last_Column => 0); --------------------------------------------------------------------------------------- -- 20.8 function First_Line_Number --------------------------------------------------------------------------------------- function First_Line_Number (Element : in Asis.Element) return Line_Number; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns the first line number on which the text of the element resides. -- -- Returns 0 if not Is_Text_Available(Element). -- --|AN Application Note: --|AN --|AN The line number recorded for a particular element may or may --|AN not match the "true" line number of the program text for that element --|AN if the Ada environment and the local text editors do not agree on the --|AN definition of "line". For example, the Reference Manual states that any --|AN occurrence of an Ascii.Cr character is to be treated as one or more --|AN end-of-line occurrences. On most Unix systems, the editors do not treat --|AN a carriage return as being an end-of-line character. --|AN --|AN Ada treats all of the following as end-of-line characters: Ascii.Cr, --|AN Ascii.Lf, Ascii.Ff, Ascii.Vt. It is up to the compilation system to --|AN determine whether sequences of these characters causes one, or more, --|AN end-of-line occurrences. Be warned, if the Ada environment and the --|AN system editor (or any other line-counting program) do not use the same --|AN end-of-line conventions, then the line numbers reported by ASIS may not --|AN match those reported by those other programs. -- --------------------------------------------------------------------------------------- -- 20.9 function Last_Line_Number --------------------------------------------------------------------------------------- function Last_Line_Number (Element : in Asis.Element) return Line_Number; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns the last line number on which the text of the element resides. -- -- Returns 0 if not Is_Text_Available(Element). -- --------------------------------------------------------------------------------------- -- 20.10 function Element_Span --------------------------------------------------------------------------------------- function Element_Span (Element : in Asis.Element) return Span; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns the span of the given element. -- -- Returns a Nil_Span if the text of a Compilation_Unit (Compilation) cannot be -- located for any reason. --|AN --|AN For this query, Element is only a means to access the --|AN Compilation_Unit (Compilation), the availability of the text of this Element --|AN itself is irrelevant to the result of the query. -- --------------------------------------------------------------------------------------- -- 20.11 function Compilation_Unit_Span --------------------------------------------------------------------------------------- function Compilation_Unit_Span (Element : in Asis.Element) return Span; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns the span of the text comprising the enclosing compilation unit of -- the given element. -- -- Returns a Nil_Span if the text of a Compilation_Unit (Compilation) cannot be -- located for any reason. --|AN --|AN For this query, Element is only a means to access the --|AN Compilation_Unit (Compilation), the availability of the text of this Element --|AN itself is irrelevant to the result of the query. -- --------------------------------------------------------------------------------------- -- 20.12 function Compilation_Span --------------------------------------------------------------------------------------- function Compilation_Span (Element : in Asis.Element) return Span; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns the span of the text comprising the compilation to which the -- element belongs. The text span may include one or more compilation units. -- -- Returns a Nil_Span if not Is_Text_Available(Element). -- --------------------------------------------------------------------------------------- -- 20.13 function Is_Nil --------------------------------------------------------------------------------------- function Is_Nil (Right : in Line) return Boolean; --------------------------------------------------------------------------------------- -- Right - Specifies the line to check -- -- Returns True if the argument is the Nil_Line. >> Add 3 lines: -- -- A Line from a Line_List obtained from any of the Lines functions -- will not be Is_Nil even if it has a length of zero. --------------------------------------------------------------------------------------- -- 20.14 function Is_Nil --------------------------------------------------------------------------------------- function Is_Nil (Right : in Line_List) return Boolean; --------------------------------------------------------------------------------------- -- Right - Specifies the line list to check -- -- Returns True if the argument has a 'Length of zero. -- --------------------------------------------------------------------------------------- -- 20.15 function Is_Nil --------------------------------------------------------------------------------------- function Is_Nil (Right : in Span) return Boolean; --------------------------------------------------------------------------------------- -- Right - Specifies the Span to check -- -- Returns True if the argument has a Nil_Span. -- --------------------------------------------------------------------------------------- -- 20.16 function Is_Equal --------------------------------------------------------------------------------------- function Is_Equal (Left : in Line; Right : in Line) return Boolean; --------------------------------------------------------------------------------------- -- Left - Specifies the first of the two lines -- Right - Specifies the second of the two lines -- -- Returns True if the two lines encompass the same text (have the same Span -- and are from the same compilation). -- --------------------------------------------------------------------------------------- -- 20.17 function Is_Identical --------------------------------------------------------------------------------------- function Is_Identical (Left : in Line; Right : in Line) return Boolean; --------------------------------------------------------------------------------------- -- Left - Specifies the first of the two lines -- Right - Specifies the second of the two lines -- -- Returns True if the two lines encompass the same text (have the same Span -- and are from the same compilation) and are from the same Context. -- --------------------------------------------------------------------------------------- -- 20.18 function Length --------------------------------------------------------------------------------------- function Length (The_Line : in Line) return Character_Position; --------------------------------------------------------------------------------------- -- The_Line - Specifies the line to query -- -- Returns the length of the line. -- >> Add 2 lines: -- Raises ASIS_Inappropriate_Line if Is_Nil (The_Line). -- --------------------------------------------------------------------------------------- -- 20.19 function Lines --------------------------------------------------------------------------------------- function Lines (Element : in Asis.Element) return Line_List; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns a list of lines covering the span of the given program element. -- -- Returns a Nil_Span if the text of a Compilation containing a given -- Element cannot be located for any reason. -- -- Line lists can be indexed to obtain individual lines. The bounds of each -- list correspond to the lines with those same numbers in the compilation -- text. -- -- The first Line of the result contains text from the compilation starting at -- the First_Line/First_Column of Element's Span. The last Line of the result -- contains text from the compilation ending at the Last_Line/Last_Column of -- the Element's Span. Text before or after those limits is not reflected -- in the returned list. --|AN --|AN For this query, Element is only a means to access the --|AN Compilation_Unit (Compilation), the availability of the text of this Element --|AN itself is irrelevant to the result of the query. -- --------------------------------------------------------------------------------------- -- 20.20 function Lines --------------------------------------------------------------------------------------- function Lines (Element : in Asis.Element; The_Span : in Span) return Line_List; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- The_Span - Specifies the textual span to return -- -- Returns a list of lines covering the given span from the compilation -- containing the given program element. -- -- Returns a Nil_Span if the text of a Compilation containing a given -- Element cannot be located for any reason. -- -- This operation can be used to access lines from text outside the span of an -- element, but still within the compilation. For example, lines containing -- preceding comments or lines between two elements. -- -- Line lists can be indexed to obtain individual lines. The bounds of each -- list correspond to the lines with those same numbers in the compilation -- text. -- -- The first Line of the result contains text from the compilation starting at -- line Span.First_Line and column Span.First_Column. The last Line of the -- result contains text from the compilation ending at line Span.Last_Line and -- column Span.Last_Column. Text before or after those limits is not -- reflected in the returned list. -- -- Raises ASIS_Inappropriate_Line_Number if Is_Nil (The_Span). If The_Span defines -- a line whose number is outside the range of text lines that can be accessed -- through the Element, the implementation is encouraged, but not required to -- raise ASIS_Inappropriate_Line_Number. --|AN --|AN For this query, Element is only a means to access the --|AN Compilation_Unit (Compilation), the availability of the text of this Element --|AN itself is irrelevant to the result of the query. -- --------------------------------------------------------------------------------------- -- 20.21 function Lines --------------------------------------------------------------------------------------- function Lines (Element : in Asis.Element; First_Line : in Line_Number_Positive; Last_Line : in Line_Number) return Line_List; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- First_Line - Specifies the first line to return -- Last_Line - Specifies the last line to return -- -- Returns a list of Lines covering the full text for each of the indicated -- lines from the compilation containing the given element. This operation -- can be used to access lines from text outside the span of an element, but -- still within the compilation. -- -- Returns a Nil_Span if the text of a Compilation containing a given -- Element cannot be located for any reason. -- -- Line lists can be indexed to obtain individual lines. The bounds of each -- list correspond to the lines with those same numbers in the compilation -- text. -- -- Raises ASIS_Inappropriate_Line_Number if the span is nil. If the span defines -- a line whose number is outside the range of text lines that can be accessed -- through the Element, the implementation is encouraged, but not required to -- raise ASIS_Inappropriate_Line_Number. --|AN --|AN For this query, Element is only a means to access the --|AN Compilation_Unit (Compilation), the availability of the text of this Element --|AN itself is irrelevant to the result of the query. -- --------------------------------------------------------------------------------------- -- 20.22 function Delimiter_Image --------------------------------------------------------------------------------------- function Delimiter_Image return Wide_String; --------------------------------------------------------------------------------------- -- Returns the string used as the delimiter separating individual lines of -- text within the program text image of an element. It is also used as the -- delimiter separating individual lines of strings returned by Debug_Image. -- --------------------------------------------------------------------------------------- -- 20.23 function Element_Image --------------------------------------------------------------------------------------- function Element_Image (Element : in Asis.Element) return Program_Text; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns a program text image of the element. The image of an element can -- span more than one line, in which case the program text returned by the -- function Delimiter_Image separates the individual lines. The bounds on -- the returned program text value are 1..N, N is as large as necessary. -- -- Returns a null string if not Is_Text_Available(Element). -- -- If an Element's Span begins at column position P, the returned program text will -- be padded at the beginning with P-1 white space characters (Ascii.' ' or -- Ascii.Ht). The first character of the Element's image will thus begin at -- character P of the returned program text. Due to the possible presence of -- Ascii.Ht characters, the "column" position of characters within the image -- might not be the same as their print-column positions when the image is -- displayed on a screen or printed. -- -- NOTE: The image of a large element can exceed the range of Program_Text. -- In this case, the exception ASIS_Failed is raised with a Status of -- Capacity_Error. Use the Lines function to operate on the image of large -- elements. -- --------------------------------------------------------------------------------------- -- 20.24 function Line_Image --------------------------------------------------------------------------------------- function Line_Image (The_Line : in Line) return Program_Text; --------------------------------------------------------------------------------------- -- The_Line - Specifies the line to query -- -- Returns a program text image of the line. The image of a single lexical -- element can be sliced from the returned value using the first and last -- column character positions from the Span of the Element. The bounds on the -- returned program text are 1 .. Length(Line). -- -- If the Line is the first line from the Lines result for an Element, it can -- represent only a portion of a line from the original compilation. If the -- span began at character position P, the first Line of it's Lines -- result is padded at the beginning with P-1 white space characters -- (Ascii.' ' or Ascii.Ht). The first character of the image will -- thus begin at character P of the program text for the first Line. Due to the -- possible presence of Ascii.Ht characters, the "column" position of -- characters within the image may not be the same as their print-column -- positions when the image is displayed or printed. -- -- Similarly, if the Line is the last line from the Lines result for an -- Element, it may represent only a portion of a line from the original -- compilation. The program text image of such a Line is shorter than the -- line from compilation and will contain only the initial portion of -- that line. -- >> Add 2 lines: -- Raises ASIS_Inappropriate_Line if Is_Nil (The_Line). -- --------------------------------------------------------------------------------------- -- 20.25 function Non_Comment_Image --------------------------------------------------------------------------------------- function Non_Comment_Image (The_Line : in Line) return Program_Text; --------------------------------------------------------------------------------------- -- The_Line - Specifies the line to query -- -- Returns a program text image of a Line up to, but excluding, any comment -- appearing in that Line. -- -- The value returned is the same as that returned by the Image function, -- except that any hyphens ("--") that start a comment, and any characters -- that follow those hyphens, are dropped. -- -- The bounds on the returned program text are 1..N, where N is one less than the -- column of any hyphens ("--") that start a comment on the line. -- >> Add 2 lines: -- Raises ASIS_Inappropriate_Line if Is_Nil (The_Line). -- --------------------------------------------------------------------------------------- -- 20.26 function Comment_Image --------------------------------------------------------------------------------------- function Comment_Image (The_Line : in Line) return Program_Text; --------------------------------------------------------------------------------------- -- The_Line - Specifies the line to query -- -- Returns a program text image of any comment on that line, excluding any -- lexical elements preceding the comment. -- -- The value returned is the same as that returned by the Image function, -- except that any program text prior to the two adjacent hyphens ("--") which start -- a comment is replaced by an equal number of spaces. If the hyphens began in -- column P of the Line, they will also begin in character position P of the -- returned program text. -- -- A null string is returned if the line has no comment. -- -- The bounds of the program text are 1..N, where N is as large as necessary. -- >> Add 2 lines: -- Raises ASIS_Inappropriate_Line if Is_Nil (The_Line). -- --------------------------------------------------------------------------------------- -- 20.27 function Is_Text_Available --------------------------------------------------------------------------------------- function Is_Text_Available (Element : in Asis.Element) return Boolean; --------------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns True if the implementation can return a valid text image for the -- given element. -- -- Returns False for any Element that Is_Nil, Is_Part_Of_Implicit, or -- Is_Part_Of_Instance. -- -- Returns False if the text of the element cannot be located for any reason -- such as renaming, deletion, or moving of text. -- --|IR Implementation Requirements: --|IR --|IR An implementation shall make text available for all explicit elements. -- --------------------------------------------------------------------------------------- -- 20.28 function Debug_Image --------------------------------------------------------------------------------------- function Debug_Image (The_Line : in Line) return Wide_String; --------------------------------------------------------------------------------------- -- The_Line - Specifies the line to convert -- -- Returns a string value containing implementation-defined debug -- information associated with the line. -- -- The return value uses Asis.Text.Delimiter_Image to separate the lines -- of multi-line results. The return value does not end with -- Asis.Text.Delimiter_Image. -- -- These values are intended for two purposes. They are suitable for -- inclusion in problem reports sent to the ASIS implementor. They can -- be presumed to contain information useful when debugging the -- implementation itself. They are also suitable for use by the ASIS -- application when printing simple application debugging messages during -- application development. They are intended to be, to some worthwhile -- degree, intelligible to the user. -- --------------------------------------------------------------------------------------- private type Line is (Implementation_Defined); Nil_Line : constant Line := Implementation_Defined; Nil_Line_List : constant Line_List (1 .. 0) := (others => Nil_Line); --------------------------------------------------------------------------------------- end Asis.Text; From roby Thu Apr 30 15:38:14 1998 Return-Path: Received: by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id PAA13032; Thu, 30 Apr 1998 15:38:13 -0400 Date: Thu, 30 Apr 1998 15:38:13 -0400 From: roby (Clyde Roby) Message-Id: <199804301938.PAA13032@cronus.csed.ida.org> To: Colket@ACM.Org Cc: croby Subject: issue093.i Content-Length: 906 Status: OR !ASIS Issue #093 !topic Nil_Line equal line with zero length? !reference ASIS 95-20.1 !from Sergey Rybin 98-02-24 !keywords Line Is_Nil empty string !discussion Clause 20.1 (type Line) and 20.13 (function Is_Nil) requires clarification on the difference between an empty line and a Nil_Line. Are Nil_Line and a line with zero length the same thing? !resolution Accept. !date 98-04-30 !Notes The following clarification has been added to clause 20.1: -- Nil_Line is the value of an unitialized Line object. Add to clause 20.13, function Is_Nil: -- -- A Line from a Line_List obtained from any of the Lines functions -- will not be Is_Nil even if it has a length of zero. Add to clause 20.18, function Length, to clause 20.24, function Line_Image, to clause 20.25, function Non_Comment_Image, and to clause 20.26, function Comment_Image: -- Raises ASIS_Inappropriate_Line if Is_Nil (The_Line). From colket@colket.org Tue May 5 17:12:32 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id RAA23906; Tue, 5 May 1998 17:12:32 -0400 Received: from smtp1.erols.com (smtp1.erols.com [207.172.3.234]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id RAA10018; Tue, 5 May 1998 17:13:53 -0400 (EDT) Received: from colket.org (207-172-53-144.s144.tnt4.brd.erols.com [207.172.53.144]) by smtp1.erols.com (8.8.8/8.8.5) with ESMTP id RAA13910; Tue, 5 May 1998 17:13:50 -0400 (EDT) Message-ID: <354F80FB.C8E29EE3@colket.org> Date: Tue, 05 May 1998 17:13:31 -0400 From: Currie Colket Reply-To: colket@colket.org X-Mailer: Mozilla 4.04 [en] (Win95; I) MIME-Version: 1.0 To: Clyde Roby , ASIS Technical CC: Colket@ACM.Org, croby@ida.org Subject: Issue #093 References: <199804301938.PAA13032@cronus.csed.ida.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Length: 1353 Status: OR Dear asis-technical, Attached is issue #093 with a proposed resolution of ACCEPT and the proposed solution. The solution was developed with the originator. This solution will be made part of the ASIS DIS if there are no negative comments addressed to asis-technical by 15 May. Please send concerns to the asis-technical mailing list with Issue #093 in the subject line. v/r Currie Colket > !ASIS Issue #093 > !topic Nil_Line equal line with zero length? > !reference ASIS 95-20.1 > !from Sergey Rybin 98-02-24 > !keywords Line Is_Nil empty string > !discussion > > Clause 20.1 (type Line) and 20.13 (function Is_Nil) requires > clarification on the difference between an empty line and a Nil_Line. > Are Nil_Line and a line with zero length the same thing? > > !resolution Accept. > !date 98-04-30 > !Notes > > The following clarification has been added to clause 20.1: > > -- Nil_Line is the value of an unitialized Line object. > > Add to clause 20.13, function Is_Nil: > > -- > -- A Line from a Line_List obtained from any of the Lines functions > -- will not be Is_Nil even if it has a length of zero. > > Add to clause 20.18, function Length, to clause 20.24, function > Line_Image, to clause 20.25, function Non_Comment_Image, and to > clause 20.26, function Comment_Image: > > -- Raises ASIS_Inappropriate_Line if Is_Nil (The_Line).