1Pegex::Input(3) User Contributed Perl Documentation Pegex::Input(3)
2
3
4
6 Pegex::Input - Pegex Parser Input Abstraction
7
9 use Pegex;
10 use Pegex::Input;
11 my $ast = pegex($foo_grammar)->parse(Pegex::Input->new(string => $foo_input));
12
14 Pegex::Parser parses input. The input can be a string, a string
15 reference, a file path, or an open file handle. Pegex::Input is an
16 abstraction over any type of input. It provides a uniform interface to
17 the parser.
18
20 You call new() with two arguments, where the first argument is the
21 input type:
22
23 Pegex::Input->new(file => 'file.txt')
24
25 The following input types are available:
26
27 string
28 Input is a string.
29
30 stringref
31 Input is a string reference. This may be desirable for really long
32 strings.
33
34 file
35 Input is a file path name to be opened and read.
36
37 handle
38 Input is from a opened file handle, to be read.
39
41 Ingy döt Net <ingy@cpan.org>
42
44 Copyright 2010-2018. Ingy döt Net.
45
46 This program is free software; you can redistribute it and/or modify it
47 under the same terms as Perl itself.
48
49 See <http://www.perl.com/perl/misc/Artistic.html>
50
51
52
53perl v5.28.0 2018-11-12 Pegex::Input(3)