[libparser-mgc-perl] 10/12: Import of PEVANS/Parser-MGC-0.10 from CPAN.

Jonas Smedegaard dr at jones.dk
Sat Dec 17 17:37:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag PEVANS
in repository libparser-mgc-perl.

commit 2215d4f86a1d411507abcd082892eea1c7c36e1e
Author: Paul Evans <leonerd at leonerd.org.uk>
Date:   Mon Feb 6 00:09:15 2012 +0000

    Import of PEVANS/Parser-MGC-0.10 from CPAN.
    
    gitpan-cpan-distribution: Parser-MGC
    gitpan-cpan-version:      0.10
    gitpan-cpan-path:         PEVANS/Parser-MGC-0.10.tar.gz
    gitpan-cpan-author:       PEVANS
    gitpan-cpan-maturity:     released
---
 Changes           |   3 +
 LICENSE           |   8 +--
 META.json         |   6 +-
 META.yml          |   6 +-
 Makefile.PL       |  22 +++----
 README            | 174 +++++++++++++++++++++++++++---------------------------
 lib/Parser/MGC.pm |  40 ++++++++++---
 t/02expect.t      |  18 +++++-
 8 files changed, 161 insertions(+), 116 deletions(-)

diff --git a/Changes b/Changes
index 4d45998..4699ce1 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Parser-MGC
 
+0.10    CHANGES:
+         * Added ->maybe_expect, for higher performance parsers
+
 0.09    CHANGES:
          * Added ->pos accessor and ->fail_from to throw failures from other
            locations
diff --git a/LICENSE b/LICENSE
index 254d384..6e7c191 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-This software is copyright (c) 2011 by Paul Evans <leonerd at leonerd.org.uk>.
+This software is copyright (c) 2012 by Paul Evans <leonerd at leonerd.org.uk>.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2011 by Paul Evans <leonerd at leonerd.org.uk>.
+This software is Copyright (c) 2012 by Paul Evans <leonerd at leonerd.org.uk>.
 
 This is free software, licensed under:
 
@@ -22,7 +22,7 @@ This is free software, licensed under:
                      Version 1, February 1989
 
  Copyright (C) 1989 Free Software Foundation, Inc.
-                    51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ 51 Franklin St, Suite 500, Boston, MA  02110-1335  USA
 
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
@@ -272,7 +272,7 @@ That's all there is to it!
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2011 by Paul Evans <leonerd at leonerd.org.uk>.
+This software is Copyright (c) 2012 by Paul Evans <leonerd at leonerd.org.uk>.
 
 This is free software, licensed under:
 
diff --git a/META.json b/META.json
index defc4a3..aca32f7 100644
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Paul Evans <leonerd at leonerd.org.uk>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.110930",
+   "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.113640",
    "license" : [
       "perl_5"
    ],
@@ -29,7 +29,7 @@
    "provides" : {
       "Parser::MGC" : {
          "file" : "lib/Parser/MGC.pm",
-         "version" : "0.09"
+         "version" : "0.10"
       }
    },
    "release_status" : "stable",
@@ -38,5 +38,5 @@
          "http://dev.perl.org/licenses/"
       ]
    },
-   "version" : "0.09"
+   "version" : "0.10"
 }
diff --git a/META.yml b/META.yml
index 86e65a3..e195ae3 100644
--- a/META.yml
+++ b/META.yml
@@ -6,7 +6,7 @@ build_requires:
   File::Temp: 0
   Test::More: 0
 dynamic_config: 1
-generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.110930'
+generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.113640'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -15,9 +15,9 @@ name: Parser-MGC
 provides:
   Parser::MGC:
     file: lib/Parser/MGC.pm
-    version: 0.09
+    version: 0.10
 requires:
   File::Slurp: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.09
+version: 0.10
diff --git a/Makefile.PL b/Makefile.PL
index 19524c4..7ac14ba 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,15 +2,15 @@
 use ExtUtils::MakeMaker;
 WriteMakefile
 (
-          'NAME' => 'Parser::MGC',
-          'VERSION_FROM' => 'lib/Parser/MGC.pm',
-          'PREREQ_PM' => {
-                           'File::Slurp' => 0,
-                           'File::Temp' => 0,
-                           'Test::More' => 0
-                         },
-          'INSTALLDIRS' => 'site',
-          'EXE_FILES' => [],
-          'PL_FILES' => {}
-        )
+  'NAME' => 'Parser::MGC',
+  'VERSION_FROM' => 'lib/Parser/MGC.pm',
+  'PREREQ_PM' => {
+                   'File::Slurp' => 0,
+                   'File::Temp' => 0,
+                   'Test::More' => 0
+                 },
+  'INSTALLDIRS' => 'site',
+  'EXE_FILES' => [],
+  'PL_FILES' => {}
+)
 ;
diff --git a/README b/README
index 2ed87dd..9f4b813 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 NAME
-    "Parser::MGC" - build simple recursive-descent parsers
+    `Parser::MGC' - build simple recursive-descent parsers
 
 SYNOPSIS
      package My::Grammar::Parser
@@ -28,7 +28,7 @@ SYNOPSIS
 DESCRIPTION
     This base class provides a low-level framework for building
     recursive-descent parsers that consume a given input string from left to
-    right, returning a parse structure. It takes its name from the "m//gc"
+    right, returning a parse structure. It takes its name from the `m//gc'
     regexps used to implement the token parsing behaviour.
 
     It provides a number of token-parsing methods, which each extract a
@@ -41,69 +41,63 @@ DESCRIPTION
 
 CONSTRUCTOR
   $parser = Parser::MGC->new( %args )
-    Returns a new instance of a "Parser::MGC" object. This must be called on
-    a subclass that provides a "parse" method.
+    Returns a new instance of a `Parser::MGC' object. This must be called on
+    a subclass that provides a `parse' method.
 
     Takes the following named arguments
 
     patterns => HASH
-            Keys in this hash should map to quoted regexp ("qr//")
+            Keys in this hash should map to quoted regexp (`qr//')
             references, to override the default patterns used to match
-            tokens. See "PATTERNS" below
+            tokens. See `PATTERNS' below
 
     accept_0o_oct => BOOL
-            If true, the "token_int" method will also accept integers with a
-            "0o" prefix as octal.
+            If true, the `token_int' method will also accept integers with a
+            `0o' prefix as octal.
 
 PATTERNS
     The following pattern names are recognised. They may be passed to the
-    constructor in the "patterns" hash, or provided as a class method under
-    the name "pattern_*name*".
-
-    *   ws
+    constructor in the `patterns' hash, or provided as a class method under
+    the name `pattern_*name*'.
 
+    * ws
         Pattern used to skip whitespace between tokens. Defaults to
-        "/[\s\n\t]+/"
-
-    *   comment
+        `/[\s\n\t]+/'
 
+    * comment
         Pattern used to skip comments between tokens. Undefined by default.
 
-    *   int
-
-        Pattern used to parse an integer by "token_int". Defaults to
-        "/-?(?:0x[[:xdigit:]]+|[[:digit:]]+)/". If "accept_0o_oct" is given,
-        then this will be expanded to match "/0o[0-7]+/" as well.
-
-    *   float
+    * int
+        Pattern used to parse an integer by `token_int'. Defaults to
+        `/-?(?:0x[[:xdigit:]]+|[[:digit:]]+)/'. If `accept_0o_oct' is given,
+        then this will be expanded to match `/0o[0-7]+/' as well.
 
-        Pattern used to parse a floating-point number by "token_float".
-        Defaults to "/-?(?:\d*\.\d+|\d+\.)(?:e-?\d+)?|-?\d+e-?\d+/i".
+    * float
+        Pattern used to parse a floating-point number by `token_float'.
+        Defaults to `/-?(?:\d*\.\d+|\d+\.)(?:e-?\d+)?|-?\d+e-?\d+/i'.
 
-    *   ident
+    * ident
+        Pattern used to parse an identifier by `token_ident'. Defaults to
+        `/[[:alpha:]_]\w*/'
 
-        Pattern used to parse an identifier by "token_ident". Defaults to
-        "/[[:alpha:]_]\w*/"
-
-    *   string_delim
-
-        Pattern used to delimit a string by "token_string". Defaults to
-        "/["']/".
+    * string_delim
+        Pattern used to delimit a string by `token_string'. Defaults to
+        `/["']/'.
 
 METHODS
   $result = $parser->from_string( $str )
-    Parse the given literal string and return the result from the "parse"
+    Parse the given literal string and return the result from the `parse'
     method.
 
   $result = $parser->from_file( $file )
     Parse the given file, which may be a pathname in a string, or an opened
-    IO handle, and return the result from the "parse" method.
+    IO handle, and return the result from the `parse' method.
 
   $result = $parser->from_reader( \&reader )
-    Parse the input which is read by the "reader" function. This function
+    Parse the input which is read by the `reader' function. This function
     will be called in scalar context to generate portions of string to
-    parse, being passed the $parser object. The function should return
-    "undef" when it has no more string to return.
+    parse, being passed the `$parser' object. The function should return
+    `undef' when it has no more string to return.
 
      $reader->( $parser )
 
@@ -118,7 +112,7 @@ METHODS
     cause parse failures.
 
   $pos = $parser->pos
-    Returns the current parse position, as a charcter offset from the
+    Returns the current parse position, as a character offset from the
     beginning of the file or string.
 
   ( $lineno, $col, $text ) = $parser->where
@@ -131,28 +125,28 @@ METHODS
     Aborts the current parse attempt with the given message string. The
     failure message will include the line and column position, and the line
     of input that failed at the current parse position, or a position
-    earlier obtained using the "pos" method.
+    earlier obtained using the `pos' method.
 
   $eos = $parser->at_eos
     Returns true if the input string is at the end of the string.
 
   $level = $parser->scope_level
-    Returns the number of nested "scope_of" calls that have been made.
+    Returns the number of nested `scope_of' calls that have been made.
 
 STRUCTURE-FORMING METHODS
     The following methods may be used to build a grammatical structure out
     of the defined basic token-parsing methods. Each takes at least one code
-    reference, which will be passed the actual $parser object as its first
+    reference, which will be passed the actual `$parser' object as its first
     argument.
 
   $ret = $parser->maybe( $code )
-    Attempts to execute the given $code reference in scalar context, and
+    Attempts to execute the given `$code' reference in scalar context, and
     returns what it returned. If the code fails to parse by calling the
-    "fail" method then none of the input string will be consumed; the
-    current parsing position will be restored. "undef" will be returned in
+    `fail' method then none of the input string will be consumed; the
+    current parsing position will be restored. `undef' will be returned in
     this case.
 
-    This may be considered to be similar to the "?" regexp qualifier.
+    This may be considered to be similar to the `?' regexp qualifier.
 
      sub parse_declaration
      {
@@ -168,13 +162,13 @@ STRUCTURE-FORMING METHODS
      }
 
   $ret = $parser->scope_of( $start, $code, $stop )
-    Expects to find the $start pattern, then attempts to execute the given
-    $code reference, then expects to find the $stop pattern. Returns
+    Expects to find the `$start' pattern, then attempts to execute the given
+    `$code' reference, then expects to find the `$stop' pattern. Returns
     whatever the code reference returned.
 
-    While the code is being executed, the $stop pattern will be used by the
-    token parsing methods as an end-of-scope marker; causing them to raise a
-    failure if called at the end of a scope.
+    While the code is being executed, the `$stop' pattern will be used by
+    the token parsing methods as an end-of-scope marker; causing them to
+    raise a failure if called at the end of a scope.
 
      sub parse_block
      {
@@ -183,7 +177,7 @@ STRUCTURE-FORMING METHODS
         $self->scope_of( "{", sub { $self->parse_statements }, "}" );
      }
 
-    If the $start pattern is undefined, it is presumed the caller has
+    If the `$start' pattern is undefined, it is presumed the caller has
     already checked for this. This is useful when the stop pattern needs to
     be calculated based on the start pattern.
 
@@ -198,9 +192,9 @@ STRUCTURE-FORMING METHODS
      }
 
   $ret = $parser->list_of( $sep, $code )
-    Expects to find a list of instances of something parsed by $code,
-    separated by the $sep pattern. Returns an ARRAY ref containing a list of
-    the return values from the $code.
+    Expects to find a list of instances of something parsed by `$code',
+    separated by the `$sep' pattern. Returns an ARRAY ref containing a list
+    of the return values from the `$code'.
 
     This method does not consider it an error if the returned list is empty;
     that is, that the scope ended before any item instances were parsed from
@@ -214,11 +208,11 @@ STRUCTURE-FORMING METHODS
      }
 
   $ret = $parser->sequence_of( $code )
-    A shortcut for calling "list_of" with an empty string as separator;
-    expects to find at least one instance of something parsed by $code,
+    A shortcut for calling `list_of' with an empty string as separator;
+    expects to find at least one instance of something parsed by `$code',
     separated only by skipped whitespace.
 
-    This may be considered to be similar to the "+" or "*" regexp
+    This may be considered to be similar to the `+' or `*' regexp
     qualifiers.
 
      sub parse_statements
@@ -231,9 +225,9 @@ STRUCTURE-FORMING METHODS
   $ret = $parser->any_of( @codes )
     Expects that one of the given code references can parse something from
     the input, returning what it returned. Each code reference may indicate
-    a failure to parse by calling the "fail" method.
+    a failure to parse by calling the `fail' method.
 
-    This may be considered to be similar to the "|" regexp operator for
+    This may be considered to be similar to the `|' regexp operator for
     forming alternations of possible parse trees.
 
      sub parse_statement
@@ -247,17 +241,17 @@ STRUCTURE-FORMING METHODS
         );
      }
 
-    Note: This method used to be called "one_of", but was renamed for
+    Note: This method used to be called `one_of', but was renamed for
     clarity. Currently this method is provided also as an alias by the old
-    name. Code using the old name should be rewritten to "any_of" instead,
+    name. Code using the old name should be rewritten to `any_of' instead,
     as this backward-compatibility alias may be removed in a later version.
 
   $parser->commit
     Calling this method will cancel the backtracking behaviour of the
-    innermost "maybe", "list_of", "sequence_of", or "any_of" structure
-    forming method. That is, if later code then calls "fail", the exception
-    will be propagated out of "maybe", and no further code blocks will be
-    attempted by "any_of".
+    innermost `maybe', `list_of', `sequence_of', or `any_of' structure
+    forming method. That is, if later code then calls `fail', the exception
+    will be propagated out of `maybe', and no further code blocks will be
+    attempted by `any_of'.
 
     Typically this will be called once the grammatical structure of an
     alternation has been determined, ensuring that any further failures are
@@ -289,12 +283,18 @@ TOKEN PARSING METHODS
     In list context it returns the matching substring and the contents of
     any subgroups contained in the pattern.
 
-    This method will raise a parse error (by calling "fail") if the regexp
+    This method will raise a parse error (by calling `fail') if the regexp
     fails to match. Note that if the pattern could match an empty string
-    (such as for example "qr/\d*/"), the pattern will always match, even if
+    (such as for example `qr/\d*/'), the pattern will always match, even if
     it has to match an empty string. This method will not consider a failure
     if the regexp matches with zero-width.
 
+  $str = $parser->maybe_expect( ... )
+  @groups = $parser->maybe_expect( ... )
+    A convenient shortcut equivalent to calling `expect' within `maybe', but
+    implemented more efficiently, avoiding the exception-handling set up by
+    `maybe'. Returns `undef' or an empty list if the match fails.
+
   $str = $parser->substring_before( $literal )
   $str = $parser->substring_before( qr/pattern/ )
     Expects to possibly find a literal string or regexp pattern match. If it
@@ -304,7 +304,7 @@ TOKEN PARSING METHODS
 
     This method does not consume the part of input that matches, only the
     text before it. It is not considered a failure if the substring before
-    this match is empty. If a non-empty match is required, use the "fail"
+    this match is empty. If a non-empty match is required, use the `fail'
     method:
 
      sub token_nonempty_part
@@ -324,14 +324,14 @@ TOKEN PARSING METHODS
     be preserved.
 
   $val = $parser->generic_token( $name, $re, $convert )
-    Expects to find a token matching the precompiled regexp $re. If
-    provided, the $convert CODE reference can be used to convert the string
-    into a more convenient form. $name is used in the failure message if the
-    pattern fails to match.
+    Expects to find a token matching the precompiled regexp `$re'. If
+    provided, the `$convert' CODE reference can be used to convert the
+    string into a more convenient form. `$name' is used in the failure
+    message if the pattern fails to match.
 
-    If provided, the $convert function will be passed the parser and the
+    If provided, the `$convert' function will be passed the parser and the
     matching substring; the value it returns is returned from
-    "generic_token".
+    `generic_token'.
 
      $convert->( $parser, $substr )
 
@@ -348,13 +348,13 @@ TOKEN PARSING METHODS
 
   $int = $parser->token_int
     Expects to find an integer in decimal, octal or hexadecimal notation,
-    and consumes it. Negative integers, preceeded by "-", are also
+    and consumes it. Negative integers, preceeded by `-', are also
     recognised.
 
   $float = $parser->token_float
     Expects to find a number expressed in floating-point notation; a
-    sequence of digits possibly prefixed by "-", possibly containing a
-    decimal point, possibly followed by an exponent specified by "e"
+    sequence of digits possibly prefixed by `-', possibly containing a
+    decimal point, possibly followed by an exponent specified by `e'
     followed by an integer. The numerical value is then returned.
 
   $number = $parser->token_number
@@ -362,7 +362,7 @@ TOKEN PARSING METHODS
 
   $str = $parser->token_string
     Expects to find a quoted string, and consumes it. The string should be
-    quoted using """ or "'" quote marks.
+    quoted using `"' or `'' quote marks.
 
     The content of the quoted string can contain character escapes similar
     to those accepted by C or Perl. Specifically, the following forms are
@@ -378,8 +378,8 @@ TOKEN PARSING METHODS
      \0, \012         Octal character
      \x34, \x{5678}   Hexadecimal character
 
-    C's "\v" for vertical tab is not supported as it is rarely used in
-    practice and it collides with Perl's "\v" regexp escape. Perl's "\c" for
+    C's `\v' for vertical tab is not supported as it is rarely used in
+    practice and it collides with Perl's `\v' regexp escape. Perl's `\c' for
     forming other control characters is also not supported.
 
   $ident = $parser->token_ident
@@ -394,7 +394,7 @@ EXAMPLES
     Although the structure-forming methods all return a value, obtained from
     their nested parsing code, it can sometimes be more convenient to use a
     variable to accumulate a result in instead. For example, consider the
-    following parser method, designed to parse a set of "name: "value""
+    following parser method, designed to parse a set of `name: "value"'
     assignments, such as might be found in a configuration file, or
     YAML/JSON-style mapping value.
 
@@ -415,22 +415,22 @@ EXAMPLES
         return \%ret
      }
 
-    Instead of using the return value from "list_of", this method
-    accumulates values in the %ret hash, eventually returning a reference to
-    it as its result. Because of this, it can perform some error checking
+    Instead of using the return value from `list_of', this method
+    accumulates values in the `%ret' hash, eventually returning a reference
+    to it as its result. Because of this, it can perform some error checking
     while it parses; namely, rejecting duplicate keys.
 
 TODO
     *   Make unescaping of string constants more customisable. Possibly
-        consider instead a "parse_string_generic" using a loop over
-        "substring_before".
+        consider instead a `parse_string_generic' using a loop over
+        `substring_before'.
 
     *   Easy ability for subclasses to define more token types as methods.
         Perhaps provide a class method such as
 
          __PACKAGE__->has_token( hex => qr/[0-9A-F]+/i, sub { hex $_[1] } );
 
-    *   Investigate how well "from_reader" can cope with buffer splitting
+    *   Investigate how well `from_reader' can cope with buffer splitting
         across other tokens than simply skippable whitespace
 
 AUTHOR
diff --git a/lib/Parser/MGC.pm b/lib/Parser/MGC.pm
index ea9ff2f..2a0f3b3 100644
--- a/lib/Parser/MGC.pm
+++ b/lib/Parser/MGC.pm
@@ -1,14 +1,14 @@
 #  You may distribute under the terms of either the GNU General Public License
 #  or the Artistic License (the same terms as Perl itself)
 #
-#  (C) Paul Evans, 2010-2011 -- leonerd at leonerd.org.uk
+#  (C) Paul Evans, 2010-2012 -- leonerd at leonerd.org.uk
 
 package Parser::MGC;
 
 use strict;
 use warnings;
 
-our $VERSION = '0.09';
+our $VERSION = '0.10';
 
 use Carp;
 
@@ -249,8 +249,8 @@ sub from_reader
 
 =head2 $pos = $parser->pos
 
-Returns the current parse position, as a charcter offset from the beginning of
-the file or string.
+Returns the current parse position, as a character offset from the beginning
+of the file or string.
 
 =cut
 
@@ -681,9 +681,17 @@ example C<qr/\d*/>), the pattern will always match, even if it has to match an
 empty string. This method will not consider a failure if the regexp matches
 with zero-width.
 
+=head2 $str = $parser->maybe_expect( ... )
+
+=head2 @groups = $parser->maybe_expect( ... )
+
+A convenient shortcut equivalent to calling C<expect> within C<maybe>, but
+implemented more efficiently, avoiding the exception-handling set up by
+C<maybe>. Returns C<undef> or an empty list if the match fails.
+
 =cut
 
-sub expect
+sub maybe_expect
 {
    my $self = shift;
    my ( $expect ) = @_;
@@ -691,13 +699,31 @@ sub expect
    ref $expect or $expect = qr/\Q$expect/;
 
    $self->skip_ws;
-   $self->{str} =~ m/\G$expect/gc or
-      $self->fail( "Expected $expect" );
+   $self->{str} =~ m/\G$expect/gc or return;
 
    return substr( $self->{str}, $-[0], $+[0]-$-[0] ) if !wantarray;
    return map { substr( $self->{str}, $-[$_], $+[$_]-$-[$_] ) } 0 .. $#+;
 }
 
+sub expect
+{
+   my $self = shift;
+   my ( $expect ) = @_;
+
+   ref $expect or $expect = qr/\Q$expect/;
+
+   if( wantarray ) {
+      my @ret = $self->maybe_expect( $expect ) or
+         $self->fail( "Expected $expect" );
+      return @ret;
+   }
+   else {
+      defined( my $ret = $self->maybe_expect( $expect ) ) or
+         $self->fail( "Expected $expect" );
+      return $ret;
+   }
+}
+
 =head2 $str = $parser->substring_before( $literal )
 
 =head2 $str = $parser->substring_before( qr/pattern/ )
diff --git a/t/02expect.t b/t/02expect.t
index d40d394..bbfd5b0 100644
--- a/t/02expect.t
+++ b/t/02expect.t
@@ -2,7 +2,7 @@
 
 use strict;
 
-use Test::More tests => 5;
+use Test::More tests => 7;
 
 package TestParser;
 use base qw( Parser::MGC );
@@ -24,6 +24,17 @@ sub parse
    return hex +( $self->expect( qr/0x([0-9A-F]+)/i ) )[1];
 }
 
+package FooBarParser;
+use base qw( Parser::MGC );
+
+sub parse
+{
+   my $self = shift;
+
+   return $self->maybe_expect( qr/foo/i ) ||
+          $self->maybe_expect( qr/bar/i );
+}
+
 package main;
 
 my $parser = TestParser->new;
@@ -50,3 +61,8 @@ is( $@,
 $parser = HexParser->new;
 
 is( $parser->from_string( "0x123" ), 0x123, "Hex parser captures substring" );
+
+$parser = FooBarParser->new;
+
+is( $parser->from_string( "Foo" ), "Foo", "FooBar parser first case" );
+is( $parser->from_string( "Bar" ), "Bar", "FooBar parser first case" );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libparser-mgc-perl.git



More information about the Pkg-perl-cvs-commits mailing list