.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Parse::Eyapp::TokenGen 3" .TH Parse::Eyapp::TokenGen 3 "2017-06-14" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Parse::Eyapp::TokenGen \- Support for Using Parse::Eyapp as a Data Generator .SH "INTRODUCTION" .IX Header "INTRODUCTION" For a introduction to data generation using Parse::Eyapp see Parse::Eyapp::datagenerationtut. .SH "METHODS" .IX Header "METHODS" .SS "set_tokengens" .IX Subsection "set_tokengens" Receives the parser object and the pairs .PP .Vb 1 \& token => generator .Ve .PP Sets the generator attribute of the tokens. Though not strictly necessary, the generator is a Test::LectroTest::Generator object. .SS "set_weights" .IX Subsection "set_weights" Receives the parser object and the pairs .PP .Vb 1 \& token => weight .Ve .PP Sets the weight attribute of the tokens. The weight is a floating number. .SS "set_tokenweightsandgenerators" .IX Subsection "set_tokenweightsandgenerators" Receives the parser object and the pairs .PP .Vb 1 \& token => [weight, generator] .Ve .PP or .PP .Vb 1 \& token => weight .Ve .PP and sets the weight and generator attributes of the tokens. An example can be found in \f(CW\*(C`examples/generator/GenSupport.pm\*(C'\fR: .PP .Vb 10 \& $parser\->set_tokenweightsandgenerators( \& NUM => [ 2, Int(range=>[0, 9], sized=>0)], \& VAR => [ \& 0, # At the beginning, no variables are defined \& Gen { \& return Elements(keys %st)\->generate if keys %st; \& return Int(range=>[0, 9], sized=>0)\->generate; \& }, \& ], \& VARDEF => [ \& 2, \& String( length=>[1,2], charset=>"A\-NP\-Z", size => 100 ) \& ], \& \*(Aq=\*(Aq => 2, \*(Aq\-\*(Aq => 1, \*(Aq+\*(Aq => 2, \& \*(Aq*\*(Aq => 4, \*(Aq/\*(Aq => 2, \*(Aq^\*(Aq => 0.5, \& \*(Aq;\*(Aq => 1, \*(Aq(\*(Aq => 1, \*(Aq)\*(Aq => 2, \& \*(Aq\*(Aq => 2, \*(Aqerror\*(Aq => 0, \& ); .Ve .SS "token_weight" .IX Subsection "token_weight" Receives the parser object and the token and returns the weight. If an additional weight is provided the weight for the token is set. .SS "token_generator" .IX Subsection "token_generator" Receives the parser object and the token and returns the generator. If an additional generator is provided the generator for the token is set. .SS "deltaweight" .IX Subsection "deltaweight" Has the syntax: .PP .Vb 1 \& $parser\->deltaweight(TOKEN1 => deltaweight1, TOKEN2 => deltaweight2, ...) .Ve .PP increases the weight of the respective token by the associated amount. .SS "pushdeltaweight" .IX Subsection "pushdeltaweight" As \f(CW\*(C`deltaweight\*(C'\fR but the current weights of the involved tokens are saved in a stack .SS "popweight" .IX Subsection "popweight" Restores the weights of the tokens that were previously saved with \f(CW\*(C`pushdeltaweight\*(C'\fR .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 Parse::Eyapp::datagenerationtut .IP "\(bu" 4 Test::LectroTest::Generator by Tom Moertel .IP "\(bu" 4 The Design and Implementation of a Grammar-based Data Generator (1992) by Peter M. Maurer, Software Practice and Experience .IP "\(bu" 4 yagg: an easy-to-use generator for structured test inputs by David Coppit and Jiexin Lian. \&\s-1ASE\s0 '05: Proceedings of the 20th \s-1IEEE/ACM\s0 international Conference on Automated software engineering. 2005, pages 356\-359. .RS 4 .IP "\(bu" 2 , .IP "\(bu" 2 , .IP "\(bu" 2 .RE .RS 4 .RE .IP "\(bu" 4 Writing Randomly by Randall Schwartz. Linux Magazine Column 04 (Sep 1999). .IP "\(bu" 4 Generating Test Data with Enhanced Context Free Grammars by Peter M. Maurer .IP "\(bu" 4 Modules as Programs by Brian d Foy .IP "\(bu" 4 How a Script Becomes a Module by Brian d Foy. On Perlmonks: . .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 2 Hal Finkel .IP "\(bu" 2 G. Williams .IP "\(bu" 2 Thomas L. Shinnick .IP "\(bu" 2 Frank Leray .SH "AUTHOR" .IX Header "AUTHOR" William N. Braswell, Jr. (Remove \*(L"\s-1NOSPAM\*(R".\s0) .SH "ACKNOWLEDGMENTS" .IX Header "ACKNOWLEDGMENTS" This work has been supported by \s-1CEE\s0 (\s-1FEDER\s0) and the Spanish Ministry of \&\fIEducacion y Ciencia\fR through \fIPlan Nacional I+D+I\fR number \s-1TIN2005\-08818\-C04\-04\s0 (\s-1ULL::OPLINK\s0 project ). Support from Gobierno de Canarias was through \s-1GC02210601\s0 (\fIGrupos Consolidados\fR). The University of La Laguna has also supported my work in many ways and for many years. .PP A large percentage of code is verbatim taken from Parse::Yapp 1.05. The author of Parse::Yapp is Francois Desarmenien. .PP I wish to thank Francois Desarmenien for his Parse::Yapp module, to my students at La Laguna and to the Perl Community. Thanks to the people who have contributed to improve the module (see \*(L"\s-1CONTRIBUTORS\*(R"\s0 in Parse::Eyapp). Thanks to Larry Wall for giving us Perl. Special thanks to Juana. .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012 Casiano Rodriguez-Leon. Copyright © 2017 William N. Braswell, Jr. All Rights Reserved. .PP Parse::Yapp is Copyright © 1998, 1999, 2000, 2001, Francois Desarmenien. Parse::Yapp is Copyright © 2017 William N. Braswell, Jr. All Rights Reserved. .PP These modules are free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 .SH "POD ERRORS" .IX Header "POD ERRORS" Hey! \fBThe above document had some coding errors, which are explained below:\fR .IP "Around line 178:" 4 .IX Item "Around line 178:" Non-ASCII character seen before =encoding in '©'. Assuming \s-1UTF\-8\s0