1 package PPI::Token::Number::Hex;
7 PPI::Token::Number::Hex - Token class for a binary number
11 $n = 0x1234; # hexadecimal integer
15 PPI::Token::Number::Hex
16 isa PPI::Token::Number
22 The C<PPI::Token::Number::Hex> class is used for tokens that
23 represent base-16 numbers.
30 use PPI::Token::Number ();
32 use vars qw{$VERSION @ISA};
35 @ISA = 'PPI::Token::Number';
42 Returns the base for the number: 16.
52 Return the numeric value of this token.
58 my $str = $self->_literal;
59 my $neg = $str =~ s/^\-//;
61 return $neg ? -$val : $val;
68 #####################################################################
71 sub __TOKENIZER__on_char {
74 my $char = substr( $t->{line}, $t->{line_cursor}, 1 );
76 # Allow underscores straight through
77 return 1 if $char eq '_';
79 if ( $char =~ /[\da-f]/ ) {
83 # Doesn't fit a special case, or is after the end of the token
85 $t->_finalize_token->__TOKENIZER__on_char( $t );
94 See the L<support section|PPI/SUPPORT> in the main module.
98 Chris Dolan E<lt>cdolan@cpan.orgE<gt>
102 Copyright 2006 Chris Dolan.
104 This program is free software; you can redistribute
105 it and/or modify it under the same terms as Perl itself.
107 The full text of the license can be found in the
108 LICENSE file included with this module.