Pegged suggestion to prevent collisions

Basile B. b2.temp at gmx.com
Sun Apr 19 10:36:57 UTC 2020


I'm sorry to post this here but currently I cannot create an 
account to open an issue on Github.

Today I encountered an issue after writing a peg that contains a 
rule named "Tuple".
Currently you cannot have such a rule because pegged imports 
std.typecons.

My suggestion is to make all imports in pegged selective and 
**renamed** e.g instead of

   import std.typecons;

rewrite

   import std.typecons : PeggedTuple = Tuple;

to minimize the chances of collisions. The problem is known, 
documented [1] but I dont see why the solution I propose would 
not work.

Later I've also noticed an inaccurary in the wiki, on this page 
[2] it is stated that

   "Predefined Parsers are all lowercase"

This sould be

   "Predefined Parsers, to the exception of `Alpha`, are lowercase"

--
[1] 
https://github.com/PhilippeSigaud/Pegged/wiki/Predefined-Parsers#public-imports
[2] 
https://github.com/PhilippeSigaud/Pegged/wiki/Declaring-a-Grammar


More information about the Digitalmars-d mailing list