[m-dev.] Adding `.' as a module separator
David Overton
dmo at cs.mu.OZ.AU
Mon Dec 2 13:24:41 AEDT 2002
On Mon, Dec 02, 2002 at 12:47:36PM +1100, Ralph Becket wrote:
> Ralph Becket, Monday, 2 December 2002:
> >
> > 3. parse the strings using a rule like "first split at the '.'s, then
> > split the pieces at the '__'s, stragglers are deemed to be part of
> > the name" (rather like the way we currently interpret 'foo____bar',
> > namely as `qualified("foo", unqualified("__bar"))'). This still
> > wouldn't tell us what to do in cases like 'foo..bar', although we could
> > use the same rule as we currently do for '__'.
>
> How about this as a rule:
>
> Scanning from left to right, a substring in the set{'.', '__', ':'}
> is interpreted as a module separator iff it separates two simple names
> (where a simple name is a string interpreted as having no structure.)
>
> So the string ".a..b__c.__d__.e__" would be broken up as
> ".a", ".b", "c", "__d", ".e__".
Currently we only allow one kind of module qualification per name. If
the name contains a colon (':') then any occurrences of `__' are treated
as part of the name rather than as a module qualifier. I think if we
are planning to phase out `__' as a module-qualifier in
preference to `.' then we should stick to a simple rule like this. The
way `__' is parsed at the moment is a bit of a hack anyway because it's
not recognised as a separate token by the lexer (IIRC).
David
--
David Overton Uni of Melbourne +61 3 8344 9159
dmo at cs.mu.oz.au Monash Uni (Clayton) +61 3 9905 5779
http://www.cs.mu.oz.au/~dmo Mobile Phone +61 4 0337 4393
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list