common/tools/lib/auto/Text/CSV/parse.al
author MattD <mattd@symbian.org>
Wed, 12 Aug 2009 18:04:33 +0100
changeset 350 1e8f54745323
parent 89 a8aa5d600806
permissions -rw-r--r--
sf-postbuild - running analysis in parallel with evalid and post-build zipping.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
89
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     1
# NOTE: Derived from blib\lib\Text\CSV.pm.
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     2
# Changes made here will be lost when autosplit again.
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     3
# See AutoSplit.pm.
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     4
package Text::CSV;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     5
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     6
#line 177 "blib\lib\Text\CSV.pm (autosplit into blib\lib\auto/Text\CSV/parse.al)"
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     7
################################################################################
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     8
# parse
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     9
#
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    10
#    object method returning success or failure.  the given argument is expected
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    11
#    to be a valid comma-separated value.  failure can be the result of
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    12
#    no arguments or an argument containing an invalid sequence of characters.
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    13
#    side-effects include:
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    14
#      setting status()
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    15
#      setting fields()
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    16
#      setting string()
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    17
#      setting error_input()
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    18
################################################################################
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    19
sub parse {
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    20
  my $self = shift;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    21
  $self->{'_STRING'} = shift;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    22
  $self->{'_FIELDS'} = undef;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    23
  $self->{'_ERROR_INPUT'} = $self->{'_STRING'};
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    24
  $self->{'_STATUS'} = 0;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    25
  if (!defined($self->{'_STRING'})) {
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    26
    return $self->{'_STATUS'};
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    27
  }
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    28
  my $keep_biting = 1;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    29
  my $palatable = 0;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    30
  my $line = $self->{'_STRING'};
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    31
  if ($line =~ /\n$/) {
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    32
    chop($line);
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    33
    if ($line =~ /\r$/) {
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    34
      chop($line);
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    35
    }
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    36
  }
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    37
  my $mouthful = '';
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    38
  my @part = ();
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    39
  while ($keep_biting and ($palatable = $self->_bite(\$line, \$mouthful, \$keep_biting))) {
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    40
    push(@part, $mouthful);
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    41
  }
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    42
  if ($palatable) {
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    43
    $self->{'_ERROR_INPUT'} = undef;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    44
    $self->{'_FIELDS'} = \@part;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    45
  }
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    46
  return $self->{'_STATUS'} = $palatable;
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    47
}
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    48
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    49
# end of Text::CSV::parse
a8aa5d600806 Copy Text::CSV module into source and change to use it, as we can't rely on it appearing in the Perl library when Perl 5.6.1 is installed.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    50
1;