File Coverage

blib/lib/Lingy/AST.pm
Criterion Covered Total %
statement 66 66 100.0
branch n/a
condition n/a
subroutine 22 22 100.0
pod n/a
total 88 88 100.0


line stmt bran cond sub pod time code
1             #------------------------------------------------------------------------------
2             package Lingy::AST;
3 1     1   4 use Lingy::Base;
  1         1  
  1         4  
4              
5             has module => sub { Lingy::Module->new };
6              
7             #------------------------------------------------------------------------------
8             package Lingy::Module;
9 1     1   4 use Lingy::Base;
  1         1  
  1         4  
10              
11             has class => [];
12             has name => ();
13              
14             #------------------------------------------------------------------------------
15             package Lingy::Class;
16 1     1   4 use Lingy::Base;
  1         1  
  1         4  
17              
18             # Class can be anonymous, but typically is defined with a name:
19             has name => ();
20             # Methods, attributes, class variables:
21             has namespace => {};
22             # The parent class (for inheritance):
23             has parent => ();
24             # The (names of) attributes defined by the class:
25             has attribute => [];
26             # The (names of) methods defined by the class:
27             has method => [];
28              
29             #------------------------------------------------------------------------------
30             package Lingy::Stash;
31 1     1   4 use Lingy::Base;
  1         1  
  1         4  
32              
33             has namespace => {};
34              
35             #------------------------------------------------------------------------------
36             package Lingy::Function;
37 1     1   4 use Lingy::Base;
  1         2  
  1         6  
38              
39             has name => ();
40             has signature => {};
41             has namespace => {};
42             has statement => [];
43              
44             #------------------------------------------------------------------------------
45             package Lingy::Method;
46 1     1   4 use Lingy::Base;
  1         2  
  1         3  
47             extends 'Lingy::Function';
48              
49             #------------------------------------------------------------------------------
50             package Lingy::Signature;
51 1     1   4 use Lingy::Base;
  1         1  
  1         4  
52              
53             #------------------------------------------------------------------------------
54             package Lingy::Attribute;
55 1     1   3 use Lingy::Base;
  1         1  
  1         8  
56              
57             #------------------------------------------------------------------------------
58             package Lingy::Statement;
59 1     1   3 use Lingy::Base;
  1         1  
  1         4  
60              
61             #------------------------------------------------------------------------------
62             package Lingy::Assignment;
63 1     1   36 use Lingy::Base;
  1         2  
  1         3  
64             extends 'Lingy::Statement';
65              
66             #------------------------------------------------------------------------------
67             package Lingy::Expression;
68 1     1   4 use Lingy::Base;
  1         1  
  1         4  
69              
70             #------------------------------------------------------------------------------
71             # Base class for all data type classes
72             #------------------------------------------------------------------------------
73             package Lingy::Object;
74 1     1   3 use Lingy::Base;
  1         1  
  1         4  
75              
76             has type => sub { die };
77             has value => ();
78              
79             #------------------------------------------------------------------------------
80             package Lingy::Symbol;
81 1     1   4 use Lingy::Base;
  1         2  
  1         3  
82             extends 'Lingy::Object';
83              
84 1     1   4 use constant type => 'Sym';
  1         2  
  1         79  
85              
86             #------------------------------------------------------------------------------
87             package Lingy::String;
88 1     1   4 use Lingy::Base;
  1         1  
  1         3  
89             extends 'Lingy::Object';
90              
91 1     1   4 use constant type => 'Str';
  1         2  
  1         44  
92              
93             #------------------------------------------------------------------------------
94             package Lingy::Number;
95 1     1   3 use Lingy::Base;
  1         5  
  1         4  
96             extends 'Lingy::Object';
97              
98 1     1   4 use constant type => 'Num';
  1         2  
  1         79  
99              
100             #------------------------------------------------------------------------------
101             package Lingy::Boolean;
102 1     1   4 use Lingy::Base;
  1         1  
  1         4  
103             extends 'Lingy::Object';
104              
105 1     1   4 use constant type => 'Bool';
  1         2  
  1         50  
106              
107             #------------------------------------------------------------------------------
108             package Lingy::Null;
109 1     1   4 use Lingy::Base;
  1         1  
  1         5  
110             extends 'Lingy::Object';
111              
112 1     1   4 use constant type => 'Null';
  1         2  
  1         65  
113              
114             1;