dlang-community / Pegged

A Parsing Expression Grammar (PEG) module, using the D programming language.
533 stars 66 forks source link

std.typecons : Tuple collision #290

Open Zardoz89 opened 4 years ago

Zardoz89 commented 4 years ago

Source : https://forum.dlang.org/post/vobazwubfleohhzteqdp@forum.dlang.org


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

veelo commented 4 years ago

I took care of the wiki.