Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 78 lines (55 sloc) 1.909 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
#-----------------------------------------------------------------
# Rules for use
#-----------------------------------------------------------------

token_use: /\buse\s/ use_stuff /[;}]/
{ $return=$item{use_stuff} }

use_stuff: (base | parent | version | module)

base: "base" import_list

parent: "parent" import_list
{ $return='parent'; $return.=' '.$item[2] if $item[2] !~ /^\s*-norequire\b/; }

module: module_name module_more
{ $return=$item{module_name} }

module_name: /[\w:]+/

module_more: eos | version(?) var(?) import_list(?)

#-----------------------------------------------------------------
# Rules for require
#-----------------------------------------------------------------

token_require: /\brequire\s/ require_stuff /[;}]/
{ $return=$item{require_stuff} }

require_stuff: (version | require_name | module)

require_name: <perl_quotelike>
{ my $name=$item[1][2];
return 1 if ($name=~/\.pl$/);
$name=~s(/)(::)g;
$name=~s/\.pm//;
$return=$name;
}

#-----------------------------------------------------------------
# Rules for no
#-----------------------------------------------------------------

token_no: /\bno\s/ no_stuff /[;}]/
{ $return=$item{no_stuff} }

no_stuff: (base | version | module)

#-----------------------------------------------------------------
# General Rules
#-----------------------------------------------------------------

version: /v?[\d\._]+/

eos: { $text=~/^[\s;]+$/ ? 1 : undef;}

var: /\$[\w+]/

import_list: /[(]?/
list_item
comma_list_item(s?)
/[)]?/
{ $return=$item[2];
$return.=" ".join(" ",@{$item[3]}) if $item[3];
}
|
/[(]\s*[)]/ { $return='' }

list_item: <perl_quotelike> { $return=$item[1][2] }
|
<perl_codeblock (){}[]> { $return=$item[1] }
|
/-?\w+/ { $return=$item[1] }

comma_list_item: comma list_item
{ $return=$item{list_item} }

comma: (',' | '=>')
Something went wrong with that request. Please try again.