This is an automated email from the git hooks/post-receive script. js pushed a commit to annotated tag Marpa-R2-2.085_003 in repository libmarpa-r2-perl.
commit 4c4896191ca2ca509d0a74a105d2b7ea303a73db Author: Jeffrey Kegler <jk...@cpan.org> Date: Sun Apr 20 21:48:10 2014 -0700 Create marpa_g_force_valued(): t+ --- cpan/libmarpa/dev/api.texi | 24 +++++++++++++++++++++--- cpan/libmarpa/dev/marpa.w | 30 ++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/cpan/libmarpa/dev/api.texi b/cpan/libmarpa/dev/api.texi index e0868cd..0ca371c 100644 --- a/cpan/libmarpa/dev/api.texi +++ b/cpan/libmarpa/dev/api.texi @@ -1420,7 +1420,7 @@ use the @cindex grammar constructor @deftypefun Marpa_Grammar marpa_g_new ( @ - Marpa_Config* configuration ) + Marpa_Config* @var{configuration} ) Creates a new grammar time object. The returned grammar object is not yet precomputed, @@ -1442,6 +1442,24 @@ and the error code is set in @var{configuration}. @end deftypefun +@deftypefun int marpa_g_force_valued ( @ + Marpa_Grammar @var{g} ) + +It is recommended that +this call be made immediately after the +grammar constructor. +It turns off a deprecated feature. + +The @code{marpa_g_force_valued} forces all the +symbols in a grammar to be ``valued''. +The opposite of a valued symbol is one about whose value +you do not care. +This distinction has been made in the past in hope +of gaining efficiencies at evaluation time. +Current thinking is that the gains do not repay the extra +complexity. +@end deftypefun + @node Grammar reference counting, Symbols, Grammar constructor, Grammar methods @section Tracking the reference count of the grammar @cindex grammar destructor @@ -3257,10 +3275,10 @@ Failures: On failure, @minus{}2. Marpa_Order @var{o}) These methods, respectively, set and discover the ``high rank only'' flag of ordering @var{o}. -A flag of 1 indicates that, when ranking, +A @var{flag} of 1 indicates that, when ranking, all choices should be discarded except those of the highest rank. -A valued status of 0 indicates that +A @var{flag} of 0 indicates that no choices should be discarded on the basis of their rank. diff --git a/cpan/libmarpa/dev/marpa.w b/cpan/libmarpa/dev/marpa.w index 53f4b42..80ca56f 100644 --- a/cpan/libmarpa/dev/marpa.w +++ b/cpan/libmarpa/dev/marpa.w @@ -1370,8 +1370,34 @@ is arbitrary. BITFIELD t_is_valued:1; BITFIELD t_is_valued_locked:1; @ @<Initialize XSY elements@> = - XSY_is_Valued(xsy) = 0; - XSY_is_Valued_Locked(xsy) = 0; + XSY_is_Valued(xsy) = g->t_force_valued ? 1 : 0; + XSY_is_Valued_Locked(xsy) = g->t_force_valued ? 1 : 0; + +@ Force all symbols to be valued. +Unvalued symbols are deprecated, +so that this will be the default, going +forward. +@ @<Int aligned grammar elements@>= int t_force_valued; +@ @<Initialize grammar elements@> = + g->t_force_valued = 0; +@ @<Function definitions@> = +int marpa_g_force_valued( Marpa_Grammar g) +{ + XSYID xsyid; + @<Return |-2| on failure@>@; + for (xsyid = 0; xsyid < XSY_Count_of_G(g); xsyid++) { + const XSY xsy = XSY_by_ID(xsyid); + if (!XSY_is_Valued(xsy) && XSY_is_Valued_Locked(xsy)) + { + MARPA_ERROR ( MARPA_ERR_VALUED_IS_LOCKED); + return failure_indicator; + } + XSY_is_Valued(xsy) = 1; + XSY_is_Valued_Locked(xsy) = 1; + } + g->t_force_valued = 1; + return 0; +} @ @<Function definitions@> = int marpa_g_symbol_is_valued( -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmarpa-r2-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits