PhilippeSigaud / Pegged

A Parsing Expression Grammar (PEG) module, using the D programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

std.typecons : Tuple collision

Zardoz89 opened this issue · comments

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

I took care of the wiki.