How to use existing "Guesser"?

Apr 9, 2012 at 6:28 PM
Edited Apr 9, 2012 at 6:45 PM

Hello! Thanks for GPPG! It is greatly simplifying programmers' lives.

Seems to me, this question isn't so deep as some other here, however, I have a little problem: there are several light parsers generated with GPPG in my project, and things for codepage definition (namespace Guesser) are generating with each of them every time. So, after every change I have two namespaces with the same name inside the one project.

But generally speaking it should be created just one time and then all parsers may use it... Is it possible to disable 'Guesser' inclusion in output file?

Apr 11, 2012 at 5:55 AM

Hi BBreaker

The simple way to avoid this problem is to generate all the scanners with the /noEmbedBuffer option  ("%option noembedbuffer" in the *.lex file will have the same effect). That way the buffer code is placed in the file GplexBuffers.cs which gplex will emit.  The buffer code, including the Guesser code will live in the QUT.GplexBuffers namespace, and will be shared by all the scanners. 

Actually, if you run gplex with the /noEmbedBuffers option several times you will actually emit GplexBuffers.cs several times, but the later emits will just overwrite the equally named earlier ones.  The option names are case-invariant both on the command line, and as part of an %option declaration in the spec.

Section 4.2 of the gplex doco has more on all this.

If you still have problems send me a message on CodePlex and we can switch to regular email.

Thanks for the question


Apr 20, 2012 at 3:10 PM

Problem is solved, thanks for the answer!