summaryrefslogtreecommitdiff
path: root/embed.h
diff options
context:
space:
mode:
authorDavid Golden <dagolden@cpan.org>2010-01-13 21:47:30 -0500
committerDavid Golden <dagolden@cpan.org>2010-01-13 22:04:08 -0500
commit91152fc19d1c59a1213e39f74ac8a80f4a015f5e (patch)
tree13df618732832e19928bf20a21a4f6dbf7a9bc67 /embed.h
parent32709fdf41543f067562e0dc9944448dd11d2c28 (diff)
downloadperl-91152fc19d1c59a1213e39f74ac8a80f4a015f5e.tar.gz
Omnibus strict and lax version parsing
Authors: John Peacock, David Golden and Zefram The goal of this mega-patch is to enforce strict rules for version numbers provided to 'package NAME VERSION' while formalizing the prior, lax rules used for version object creation. Parsing for use() is unchanged. version.pm adds two globals, $STRICT and $LAX, containing regular expressions that define the rules. There are two additional functions -- version::is_strict and version::is_lax -- that test an argument against these rules. However, parsing of strings that might contain version numbers is done in core via the Perl_scan_version function, which may be called during compilation or may be called later when version objects are created by Perl_new_version or Perl_upg_version. A new helper function, Perl_prescan_version, has been added to validate a string under either strict or lax rules. This is used in toke.c for 'package NAME VERSION' in strict mode and by Perl_scan_version in lax mode. It matches the behavior of the verison.pm regular expressions, but does not use them directly. A new test file, comp/packagev.t, validates strict and lax behaviors of 'package NAME VERSION' and 'version->new(VERSION)' respectively and verifies their behavior against the $STRICT and $LAX regular expressions, as well. Validating these two implementation should help ensure they each work as intended. Other files and tests have been modified as necessary to support these changes. There is remaining work to be done in a few areas: * documenting all changes in behavior and new functions * determining proper treatment of "," as decimal separators in various locales * updating diagnostics for new error messages * porting changes back to the version.pm distribution on CPAN, including pure-Perl versions
Diffstat (limited to 'embed.h')
-rw-r--r--embed.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/embed.h b/embed.h
index c949c5c6db..246106bcf9 100644
--- a/embed.h
+++ b/embed.h
@@ -636,6 +636,7 @@
#define new_stackinfo Perl_new_stackinfo
#define scan_vstring Perl_scan_vstring
#define scan_version Perl_scan_version
+#define prescan_version Perl_prescan_version
#define new_version Perl_new_version
#define upg_version Perl_upg_version
#define vverify Perl_vverify
@@ -1591,6 +1592,7 @@
#define check_uni S_check_uni
#define force_next S_force_next
#define force_version S_force_version
+#define force_strict_version S_force_strict_version
#define force_word S_force_word
#define tokeq S_tokeq
#define readpipe_override S_readpipe_override
@@ -3036,6 +3038,7 @@
#define new_stackinfo(a,b) Perl_new_stackinfo(aTHX_ a,b)
#define scan_vstring(a,b,c) Perl_scan_vstring(aTHX_ a,b,c)
#define scan_version(a,b,c) Perl_scan_version(aTHX_ a,b,c)
+#define prescan_version(a,b,c,d,e,f,g) Perl_prescan_version(aTHX_ a,b,c,d,e,f,g)
#define new_version(a) Perl_new_version(aTHX_ a)
#define upg_version(a,b) Perl_upg_version(aTHX_ a,b)
#define vverify(a) Perl_vverify(aTHX_ a)
@@ -4000,6 +4003,7 @@
#define check_uni() S_check_uni(aTHX)
#define force_next(a) S_force_next(aTHX_ a)
#define force_version(a,b) S_force_version(aTHX_ a,b)
+#define force_strict_version(a) S_force_strict_version(aTHX_ a)
#define force_word(a,b,c,d,e) S_force_word(aTHX_ a,b,c,d,e)
#define tokeq(a) S_tokeq(aTHX_ a)
#define readpipe_override() S_readpipe_override(aTHX)