App-Nostray

 view release on metacpan or  search on metacpan

bin/nostray  view on Meta::CPAN

    if ( $opt_m && $xtra ) {
        $opt_v && $xtra && print "  --> write modified source\n";
        write_file( $file, $out );
        $files_modified++;
    }
}

sub auto_remove_extra_comma {
    my $src = [ split /\n/, shift ];
    my $xtra = 0;
    $cx->bind( src => $src );
    my $reports = $cx->eval('jshint( src, { strict: false, es5: false } )');
    for my $report (@$reports) {
        $opt_R && print JSON->new->pretty->canonical->encode($report);
        if ( $report->{reason} eq "Extra comma." ) {
            substr $src->[ $report->{line} - 1 ], $report->{character} - 1, 1, '';
            $xtra++;
        }
    }
    return join( "\n", @$src ), $xtra;
}

bin/nostray  view on Meta::CPAN


// This is the heart of JSHINT, the Pratt parser. In addition to parsing, it
// is looking for ad hoc lint patterns. We add .fud to Pratt's model, which is
// like .nud except that it is only used on the first token of a statement.
// Having .fud makes it much easier to define statement-oriented languages like
// JavaScript. I retained Pratt's nomenclature.

// .nud     Null denotation
// .fud     First null denotation
// .led     Left denotation
//  lbp     Left binding power
//  rbp     Right binding power

// They are elements of the parsing method called Top Down Operator Precedence.

    function expression(rbp, initial) {
        var left, isArray = false, isObject = false;

        if (nexttoken.id === '(end)')
            error("Unexpected early end of program.", token);

        advance();



( run in 1.602 second using v1.01-cache-2.11-cpan-2398b32b56e )