help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Further C++ operators for position


From: Akim Demaille
Subject: Re: Further C++ operators for position
Date: Tue, 5 Nov 2019 07:58:26 +0100

hi Matthew,

> Le 5 nov. 2019 à 02:10, Matthew Fernandez <address@hidden> a écrit :
> 
>> On Nov 4, 2019, at 12:16, Hans Åberg <address@hidden> wrote:
>> 
>>> On 4 Nov 2019, at 18:12, Akim Demaille <address@hidden> wrote:
>>> 
>>> In addition, think of C where you also have main.c that #include "foo.h" 
>>> somewhere, which results in main.c:1 (i.e., line 1) < foo.h:1 < ... < 
>>> foo.h:42 < ... < main.c:3.
> 
> The language I am parsing has no #include mechanism, so I did not consider 
> two positions with different filenames to be comparable. I don’t think you 
> could immediately handle comparing positions with different filenames using 
> the present data structures because, e.g., you could #include the same file 
> twice.

Which is also part of my point :)


>>> If we want a total order here, it's actually easy: positions should have a 
>>> counter somewhere which is the *total* "offset" since the first byte of the 
>>> first file.  Or something like that.
> 
> Is it? What if you parsed two separate input sources? It makes no sense to 
> order a position in one file with respect to a position in the other.

Maybe I should have used the word "offset" here, which was to read together 
with the "*total*" before it.

What I mean is a unique counter you increment each time you read a char, 
whatever the file.  Printed after @ below.

main.c:1@1 < foo.h:1@16 < ... < foo.h:42@1010 < ... < main.c:3@2020.

etc.

Cheers!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]