comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: OpenToken version 3.1 preview
Date: Thu, 23 Jul 2009 10:00:10 +0200
Date: 2009-07-23T10:00:09+02:00	[thread overview]
Message-ID: <y1569n52unt5$.11zqspfzv2asc.dlg@40tude.net> (raw)
In-Reply-To: 17b17a5b-6b54-4486-8494-650827a58dad@c1g2000yqi.googlegroups.com

On Wed, 22 Jul 2009 22:09:27 -0700 (PDT), AdaMagica wrote:

> On Jul 23, 3:41�am, Stephen Leake <stephen_le...@stephe-leake.org>
> wrote:
>> AdaMagica <christoph.gr...@eurocopter.com> writes:
>>> There is a problem with Bracketed_Comment. If it extends over more
>>> than one line, the token is correctly recognized, but the lexeme
>>> fails.
>>
>> The line feed characters are dropped from the lexeme, on Windows.
> 
> Also on Linux.
> 
>> I don't suppose you have an idea of how to fix it?
> 
> You guessed right - I haven't. I shortly browsed the code, but found
> no simple solution.
> 
>> It will be interesting to figure out how to make that test portable
>> between Windows and Gnu/Linux. The easiest way to identify which line
>> ending to use that I know of is to look at
>> GNAT.Directory_Operations.Dir_Separator; it's '\' for CR LF, '/' for
>> LF. Don't know how to deal with Mac!
> 
> There are other OSs where an end of line is not a character in the
> stream. Can OpenToken handle these?
> We could do a Get_Line and insert a LF irrespective of what the OS
> uses. If then a lexeme was output that comprises several lines
> (currently only Bracketed_Comment I think), the output routine would
> have to translate this back to the OS's New_Line (this has of course
> to be documented in the recognizer).

You could do what I did in the Simple Components for Ada parser. I
decoupled sources from the parser itself. The source is an abstract object
that provides basic operations like "get next line" and "forward to the
next line". The obvious advantage is that you need not to care about LF, CR
in the parser, and can use files, streams, strings, GUI text buffers, etc,
as a source to the same parser.

My 2 cents.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2009-07-23  8:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19 21:23 OpenToken version 3.1 preview Stephen Leake
2009-07-20  9:47 ` Stephen Leake
2009-07-21 13:03 ` AdaMagica
2009-07-23  1:41   ` Stephen Leake
2009-07-23  5:09     ` AdaMagica
2009-07-23  8:00       ` Dmitry A. Kazakov [this message]
2009-07-24 10:47         ` Stephen Leake
2009-07-24 11:11           ` Dmitry A. Kazakov
2009-07-24 10:54       ` Stephen Leake
2009-07-25  1:18         ` Stephen Leake
2009-07-23 15:19     ` vlc
2009-07-23 20:09     ` sjw
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox