Skip to content

Commit

Permalink
stash FTLocation changes on a branch for now
Browse files Browse the repository at this point in the history
  • Loading branch information
cjfields committed Aug 14, 2015
1 parent 0055530 commit 7e734fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
4 changes: 1 addition & 3 deletions lib/Bio/Grammar/FTLocation.pm6
Expand Up @@ -4,9 +4,7 @@ grammar Bio::Grammar::FTLocation {
token TOP { <location> }

#location ::= <absolute_location> | <feature_name> | <functional_operator>(<location_list>)
token location {
<absolute_location> | <complex_location>
}
token location { <absolute_location> | <complex_location> }

#absolute_location ::= <local_location> | <path> : <local_location>
token absolute_location { <local_location> | <remote_location> }
Expand Down
13 changes: 8 additions & 5 deletions lib/Bio/Tools/FTLocationParser.pm6
@@ -1,23 +1,26 @@
use v6;

# Using a variation on the old NCBI FT BNF, but perl6-ized

use Bio::Grammar::FTLocation;

class Bio::Tools::FTLocationParser {

my class FTLocation::Actions {
method location($/) { say $/.perl ~ "\n"; }

has @!location-stack;

method local_location($/) {
say $/.gist
}
}

method from-string(Str $locstr) {
my $loc;

# grab the AST from the grammar
my $ast = Bio::Grammar::FTLocation.parse($locstr, :actions(FTLocation::Actions));
#my $ast = Bio::Grammar::FTLocation.parse($locstr);

# we can do this lazily and let the class deal with the AST, or create objects
# on the fly (not an easy way to do this lazily currently)
}

}
10 changes: 5 additions & 5 deletions t/Tools/FTLocationParser.t
Expand Up @@ -13,12 +13,12 @@ ok(1);
my $fh = open('t/data/location_data.txt', :r);

my $ct = 0;
while $fh.get -> $line {
for $fh.lines -> $line {
my ($locstr, *@rest) = split("\t", $line);
$parser.from-string($locstr);
last if $ct++ == 3;
#Bio::Grammar::FTLocation.parse($locstr, :actions(Test::Actions.new()));
#ok($/.defined, $locstr);
my $ast = $parser.from-string($locstr);
#last if $ct++ == 10;
#Bio::Grammar::FTLocation.parse($locstr);
ok($ast.defined, 'yep: ' ~ $locstr);
}

$fh.close;
Expand Down

0 comments on commit 7e734fd

Please sign in to comment.