lout-users
[Top][All Lists]
Advanced

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

Greedy matching in prg2lout


From: Darren Bane
Subject: Greedy matching in prg2lout
Date: Thu, 27 Feb 2003 09:31:52 +0300 (MSK)
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.1) Gecko/20020826

Hi there,

I'm trying to add support for RSL (the RAISE Specification Language - http://www.iist.unu.edu/raise/) to prg2lout. This is somewhat different from the other programming languages supported because symbol mode should be the default, and there are many more mathematical operators.

One of these is the word 'is', which renders as the equivalence symbol (i.e. = with an extra line). I added FixedToken entries for this, and it rendered perfectly. However, now _any_ sequence of the characters i-s is replaced with equivalence, even identifiers like is_empty and is_full.

I spent a while hunting around the data structures, and tried

* Using " is " instead of "is" as the start token. However, this failed when I used is at the end of a line.

* Using a full token definition to set the start strings to { "is ", "is\t", "is\n" }. This was better, but the previous instance where is was at the end of the line now was replaced with two equivalence symbols, one in the correct place and another at the start of the next line. I'd like to get rid of the latter.

I'd really rather not change the input format, as I think it's common to all extant RAISE CASE tools, and I don't want to mandate particular whitespace conventions either as this would mean you can't use the pretty printer. What I'm hoping for is something like Perl's greedy pattern matching - prg2lout seems to be minimal; I'm making slow headway with the actual code of prg2lout, hence my request.

Thanks in advance.
--
Darren Bane


reply via email to

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