logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Pegex::Input - Pegex Parser Input Abstraction

Author

       Ingy döt Net <ingy@cpan.org>

Description

       Pegex::Parser parses input. The input can be a string, a string reference, a file path, or an open file
       handle. Pegex::Input is an abstraction over any type of input. It provides a uniform interface to the
       parser.

Name

       Pegex::Input - Pegex Parser Input Abstraction

Synopsis

           use Pegex;
           use Pegex::Input;
           my $ast = pegex($foo_grammar)->parse(Pegex::Input->new(string => $foo_input));

Usage

       You call new() with two arguments, where the first argument is the input type:

           Pegex::Input->new(file => 'file.txt')

       The following input types are available:

       string
           Input is a string.

       stringref
           Input is a string reference. This may be desirable for really long strings.

       file
           Input is a file path name to be opened and read.

       handle
           Input is from a opened file handle, to be read.

See Also