Changeset 2155


Ignore:
Timestamp:
12/22/08 00:51:36 (3 years ago)
Author:
azawawi
Message:

added syntax checking to Padre::Plugin::Perl6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre-Plugin-Perl6/lib/Padre/Document/Perl6.pm

    r2154 r2155  
    1515 
    1616my $keywords; 
     17my $issues = []; 
    1718 
    1819# Naive way to parse and colorize perl6 files 
     
    3132    eval { @tokens = $p->tokens;   1; }; 
    3233    if($EVAL_ERROR) { 
    33         say "Parsing error, bye bye ->colorize"; 
     34        say "Parsing error, bye bye ->colorize " . $EVAL_ERROR; 
     35        my @errors = split /\n/, $EVAL_ERROR; 
     36        my $lineno = -1; 
     37        my $error_msg = ""; 
     38        for my $error (@errors) { 
     39            if($error =~ /error.+line (\d+)/) { 
     40                $lineno = $1; 
     41                $error_msg = $error; 
     42            } 
     43        } 
     44        # update errors 
     45        $issues = [ { line => $lineno, msg => $error_msg, severity => 'E', desc => $EVAL_ERROR, } ]; 
    3446        return; 
     47    } else { 
     48        # no errors... 
     49        $issues = []; 
    3550    } 
    3651 
     
    98113} 
    99114 
     115sub check_syntax { 
     116    my $self = shift; 
     117    return $self->_check_syntax_internal; 
     118} 
     119 
     120sub check_syntax_in_background { 
     121    my $self = shift; 
     122    return $self->_check_syntax_internal; 
     123} 
     124 
     125sub _check_syntax_internal { 
     126    my $self = shift; 
     127    return $issues; 
     128} 
     129 
    100130sub keywords { 
    101131    if (! defined $keywords) { 
Note: See TracChangeset for help on using the changeset viewer.