MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral::NativeNumberSemantics - ECMAScript 262, Edition 5, lexical string numeric grammar default semantics package, using native perl representations
version 0.018
This modules provide a default semantics package for the actions associated to ECMAScript_262_5 lexical string numeric grammar, using native number representation, with the possible exceptions of positive zero and positive infinity: if one of them is not available natively, then the Math::BigFloat representation is used.
This module exports more methods, intended to provide a complete set of functions necessary for ECMAScript runtime.
The new() method returns an object hiding number implementation.
All method names starting with host_ return a value understandable only by the host.
All method names starting with is_ return a value understandable by perl, as well as the sign() and cmp() methods.
For every method, this module says if it should be overwriten in case of an alternate implementation. If there is no such mention this mean that the method in the package is only calling other methods. Therefore it is safe to use this module as a parent, provided that all methods marked as "should be overwriten", are as such.
Instantiate a new object that has three members:
Initialized to $opts{number} or host's positive zero
Initialized to $opts{length} or host's positive zero
Initialized to a $opts{decimal} or a host's false value
These three members are independant values. "length" is used when evaluating a number with a dot character '.'. "decimal" is a flag setted by the grammar when the Mathematical value is done on a decimal literal. Unless stated, all methods are manipulating only the "number" component.
Should be overwriten in case of alternate implementation.
New instance that is a initialized clone of $self, like new() with no option.
Cloning of $self (i.e. copy of all $self's members). Returns a new instance.
Should be overwriten in case of alternate implementation, if internal member are not named _number, _length and _decimal and if simple assignment is not enough.
Host implementation of $self's decimal setted to a true value. Returns $self.
Should be overwriten in case of alternate implementation, if internal member is not _decimal.
Host implementation of $self's number multiplied by $objmul's number. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number divided by $objdiv's number. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number modulus $objmod's number. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to nan, defaulting to Data::Float::nan if your host have it, Math::BigFloat's implementation otherwise. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to positive one, defaulting to +1. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to negative one, defaulting to -1. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to positive zero, defaulting to Data::Float::pos_zero if your host have signed zeroes, 0 otherwise. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to negative zero, defaulting to Data::Float::neg_zero if your host have signed zeroes, 0 otherwise. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to positive infinity, defaulting to Data::Float::pos_infinity if your host have infinity, Math::BigFloat->binf() otherwise. Return $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to negative infinity, defaulting to Data::Float::neg_infinity if your host have infinity, Math::BigFloat->binf('-') otherwise. Return $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number powered by $powobj's number (i.e. $self ** $powobj). Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number bit-wise and with $andobj's number (i.e. $self & $andobj). Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number bit-wise inclusive or with $orobj's number (i.e. $self | $powobj). Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number bit-wise exclusive or with $xorobj's number (i.e. $self ^ $xorobj). Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number bit-wise not (i.e. ~$self). Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number square root. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number left-shifted by $shiftobj's number in base 2 (i.e. $self <<= $shiftobj). Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number right-shifted by $shiftobj's number in base 2 (i.e. $self <<= $shiftobj). Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number incremented by one. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number decremented by one. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to positive integer represented in $string, length being initialized to the number of characters in $string. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number setted to positive hexadecimal integer represented in $string. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $self's number sign change. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of absolute value applied to $self's number. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of sign applied to $self. Returns a new instance initialized with neg_one() if $self's value is negative, pos_one() if $self's value is positive, nan() if $self's value is not a number.
Host implementation of comparison between $self and $cmpobj. Returns a new instance initialized with neg_one() if $self's value < $cmpobj's value, pos_one() if $self's value > $cmpobj's value, pos_zero() if $self's value == $cmpobj's value, nan() otherwise.
Host implementation of $addobj's number added to $self's number. Returns $self.
Should be overwriten in case of alternate implementation.
Host implementation of $subobj's number substracted from $self's number. Returns $self.
Should be overwriten in case of alternate implementation.
Increase by one the length internal member of $self. This will be the host representation of a number of characters, used to evaluate internal number. Returns $self.
Should be overwriten in case of alternate implementation, if internal member is not named _length.
Returns a new instance derived from the length internal member, initialized using $self->int(). Returns the new object instance.
Should be overwriten in case of alternate implementation, if internal member is not named _length.
Returns a perl's positive number if $self->host_value is a positive number, a perl's negative number if $self->host_value is a negative number, a perl's zero if $self->host_value is a zero, a perl's undef otherwise.
Alias for $self->new_from_cmp($cmpobj)->sign;
Returns the internal $self's number hosted in $self.
Should be overwriten in case of alternate implementation, if internal member is not named _number.
Returns the rounded internal $self's number hosted in $self.
Should be overwriten in case of alternate implementation.
Returns a perl's true or false if $self->host_value is zero. In case $self->host_value would be a blessed object, $self->host_value->is_zero() is returned if $self->host_value can do this method, otherwise undef is returned.
Should be overwriten in case of alternate implementation, if internal member is not named _number and is not an object supporting is_zero() method.
Returns a perl's true or false if $self->host_value is a +1. In case $self->host_value would be a blessed object, $self->host_value->is_one() is returned if $self->host_value can do this method, otherwise undef is returned.
Should be overwriten in case of alternate implementation, if internal member is not named _number and is not an object supporting is_one() method.
Returns a perl's true or false if $self->host_value is -1. In case $self->host_value would be a blessed object, $self->host_value->is_one('-') is returned if $self->host_value can do this method, otherwise undef is returned.
Should be overwriten in case of alternate implementation, if internal member is not named _number and is not an object supporting is_one('-') method.
Returns a perl's true or false if $self->host_value is a positive number. In case $self->host_value would be a blessed object, $self->host_value->is_pos() is returned if $self->host_value can do this method, otherwise undef is returned.
Should be overwriten in case of alternate implementation, if internal member is not named _number and is not an object supporting is_pos() method.
Returns a perl's true or false if $self->host_value is a negative number. In case $self->host_value would be a blessed object, $self->host_value->is_neg() is returned if $self->host_value can do this method, otherwise host's undefined value is returned.
Should be overwriten in case of alternate implementation, if internal member is not named _number and is not an object supporting is_neg() method.
Returns a perl's true or false if $self->host_value is infinite. In case $self->host_value would be a blessed object, $self->host_value->is_inf() is returned if $self->host_value can do this method, otherwise host's undefined value is returned.
Should be overwriten in case of alternate implementation, if internal member is not named _number and is not an object supporting is_inf() method.
Returns a perl's true or false if $self->host_value is not a number. In case $self->host_value would be a blessed object, $self->host_value->is_nan() is returned if $self->host_value can do this method, otherwise host's undefined is returned.
Should be overwriten in case of alternate implementation, if internal member is not named _number and is not an object supporting is_nan() method.
Jean-Damien Durand <jeandamiendurand@free.fr>
This software is copyright (c) 2013 by Jean-Damien Durand.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.