line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Parse::Yapp grammar for SLN |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
18
|
%{ no warnings 'uninitialized'; %} |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
5034
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# expected one shift/reduce conflict for H |
6
|
2
|
|
|
2
|
0
|
6
|
%expect 1 |
7
|
2
|
50
|
|
|
|
12
|
|
8
|
|
|
|
|
|
|
%% |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
|
0
|
ctab: ctab_bracket { +{ chain => [], attr => $_[1] } } |
11
|
72
|
|
|
72
|
|
2217
|
| atom chain ctab_bracket { +{ chain => [ $_[1], @{$_[2]} ], |
|
72
|
|
|
|
|
549
|
|
12
|
|
|
|
|
|
|
attr => $_[3] } } ; |
13
|
|
|
|
|
|
|
|
14
|
151
|
|
|
151
|
|
3161
|
chain: /* empty */ { [] } |
15
|
322
|
|
|
322
|
|
8211
|
| bondatom chain { [ @{$_[1]}, @{$_[2]}, ] } |
|
322
|
|
|
|
|
535
|
|
|
322
|
|
|
|
|
1190
|
|
16
|
|
|
|
|
|
|
| '(' bondatom chain ')' chain { |
17
|
79
|
|
|
79
|
|
2332
|
[ $_[1], @{$_[2]}, @{$_[3]}, $_[4], @{$_[5]} ] } |
|
79
|
|
|
|
|
140
|
|
|
79
|
|
|
|
|
134
|
|
|
79
|
|
|
|
|
350
|
|
18
|
|
|
|
|
|
|
; |
19
|
|
|
|
|
|
|
|
20
|
378
|
|
|
378
|
|
10751
|
bondatom: bond atom { [@_[1,2]]} |
21
|
23
|
|
|
23
|
|
662
|
| bond closure { [@_[1,2]]} |
22
|
|
|
|
|
|
|
; |
23
|
|
|
|
|
|
|
|
24
|
296
|
|
|
296
|
|
5842
|
bond: /* empty */ { +{type => '-'} } |
25
|
|
|
|
|
|
|
| bond_symbol bond_bracket { +{ |
26
|
105
|
|
|
105
|
|
4546
|
type => $_[1], |
27
|
|
|
|
|
|
|
attr => $_[2] |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
; |
31
|
|
|
|
|
|
|
|
32
|
23
|
|
|
23
|
|
712
|
closure: '@' NUM { +{closure => $_[2]} } |
33
|
|
|
|
|
|
|
; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
bond_symbol: '-' | '=' | '#' | '.' | ':'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
atom: symbol atom_bracket hcount { +{ |
38
|
450
|
|
|
450
|
|
20697
|
symbol => $_[1], |
39
|
|
|
|
|
|
|
id => $_[2][0], |
40
|
|
|
|
|
|
|
hcount => $_[3], |
41
|
|
|
|
|
|
|
attr => $_[2][1], |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
; |
45
|
|
|
|
|
|
|
|
46
|
450
|
|
|
450
|
|
9216
|
symbol: UC lc_str { $_[1] . $_[2] } |
47
|
|
|
|
|
|
|
; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
lc_str: #empty |
50
|
47
|
|
|
47
|
|
1347
|
| lc_str LC { $_[1] . $_[2] } |
51
|
|
|
|
|
|
|
; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
UC: UC_NON_H | H; |
54
|
|
|
|
|
|
|
ALPHA: UC | LC ; |
55
|
|
|
|
|
|
|
ALNUM: ALPHA | NUM; |
56
|
|
|
|
|
|
|
WORD: ALNUM | '_'; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
atom_bracket: #empty |
59
|
1
|
|
|
1
|
|
68
|
| '[' NUM ':' attr ']' { [@_[2,4]] } |
60
|
2
|
|
|
2
|
|
158
|
| '[' attr ']' { [undef, $_[2]] } |
61
|
22
|
|
|
22
|
|
705
|
| '[' NUM ']' { [$_[2], undef] } |
62
|
|
|
|
|
|
|
; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
bond_bracket: #empty |
65
|
1
|
|
|
1
|
|
99
|
| '[' attr ']' { $_[2] } |
66
|
|
|
|
|
|
|
; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
ctab_bracket: #empty |
69
|
66
|
|
|
66
|
|
3588
|
| '<' attr '>' { $_[2] } |
70
|
|
|
|
|
|
|
; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
hcount: #empty |
73
|
195
|
|
|
195
|
|
5807
|
| H NUM { $_[2] } |
74
|
90
|
|
|
90
|
|
1698
|
| H { 1 } |
75
|
|
|
|
|
|
|
; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
attr: # empty |
78
|
|
|
|
|
|
|
| attr_list; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
attr_list: key_val |
81
|
4
|
|
|
4
|
|
108
|
| attr_list ';' key_val { +{%{$_[1]}, %{$_[3]}} } |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
23
|
|
82
|
|
|
|
|
|
|
; |
83
|
|
|
|
|
|
|
|
84
|
70
|
|
|
70
|
|
4106
|
key_val: key '=' value { +{lc($_[1]) => $_[3]} } |
85
|
2
|
|
|
2
|
|
67
|
| key { +{lc($_[1]) => 'TRUE' } } |
86
|
2
|
|
|
2
|
|
61
|
| charge { +{charge => $_[1] } } |
87
|
|
|
|
|
|
|
; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
value: STRING | string; |
90
|
|
|
|
|
|
|
|
91
|
72
|
|
|
72
|
|
1583
|
key: ALPHA key_tail { $_[1] . $_[2] } ; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
key_tail: #empty |
94
|
219
|
|
|
219
|
|
20983
|
| key_tail WORD { $_[1] . $_[2] } |
95
|
|
|
|
|
|
|
; |
96
|
|
|
|
|
|
|
|
97
|
2
|
|
|
2
|
|
65
|
charge: '+' NUM { $_[2] } |
98
|
0
|
|
|
0
|
|
0
|
| '-' NUM { -$_[2] } |
99
|
0
|
|
|
0
|
|
0
|
| '+' { 1 } |
100
|
0
|
|
|
0
|
|
0
|
| '-' { -1 } |
101
|
|
|
|
|
|
|
; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
string: #empty |
104
|
24
|
|
|
24
|
|
2969
|
| string string_char { $_[1] . $_[2] } |
105
|
2
|
|
|
|
|
698
|
; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
string_char: WORD | OTHER_CHAR | '+' | '-' | '.'; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
#special chars: s/^([<>[\];=_()\@#.:+-])//s |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
%% |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _Error { |
115
|
|
|
|
|
|
|
exists $_[0]->YYData->{ERRMSG} |
116
|
0
|
0
|
|
0
|
|
0
|
and do { |
117
|
0
|
|
|
|
|
0
|
warn $_[0]->YYData->{ERRMSG}; |
118
|
0
|
|
|
|
|
0
|
delete $_[0]->YYData->{ERRMSG}; |
119
|
0
|
|
|
|
|
0
|
return; |
120
|
|
|
|
|
|
|
}; |
121
|
0
|
|
|
|
|
0
|
warn "Syntax error.\n"; |
122
|
|
|
|
|
|
|
} |
123
|
2
|
|
|
|
|
175
|
|
124
|
|
|
|
|
|
|
sub _Lexer { |
125
|
2025
|
|
|
2025
|
|
78132
|
my($parser)=shift; |
126
|
|
|
|
|
|
|
|
127
|
2025
|
100
|
|
|
|
5292
|
$parser->YYData->{INPUT} |
128
|
|
|
|
|
|
|
#or $parser->YYData->{INPUT} = |
129
|
|
|
|
|
|
|
or return('',undef); |
130
|
|
|
|
|
|
|
|
131
|
1953
|
|
|
|
|
12783
|
$parser->YYData->{INPUT}=~s/^[ \t]//; |
132
|
|
|
|
|
|
|
|
133
|
1953
|
|
|
|
|
12555
|
for ($parser->YYData->{INPUT}) { |
134
|
1953
|
100
|
|
|
|
12708
|
s/^([0-9]+(?:\.[0-9]+)?)// |
135
|
|
|
|
|
|
|
and return('NUM',$1); |
136
|
1710
|
100
|
|
|
|
4910
|
s/^(H)// |
137
|
|
|
|
|
|
|
and return('H',$1); |
138
|
1425
|
100
|
|
|
|
5995
|
s/^([A-Z])// |
139
|
|
|
|
|
|
|
and return('UC_NON_H',$1); |
140
|
975
|
100
|
|
|
|
3920
|
s/^([a-z])// |
141
|
|
|
|
|
|
|
and return('LC',$1); |
142
|
613
|
100
|
|
|
|
2054
|
s/^"(.*?)"//s |
143
|
|
|
|
|
|
|
and return('STRING',$1); |
144
|
547
|
50
|
|
|
|
4037
|
s/^([<>[\];=_()\@#.:+-])//s |
145
|
|
|
|
|
|
|
and return($1,$1); # "special" character |
146
|
0
|
0
|
|
|
|
0
|
s/^(.)//s |
147
|
|
|
|
|
|
|
and return('OTHER_CHAR',$1); |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub run { |
152
|
72
|
|
|
72
|
0
|
128
|
my($self)=shift; |
153
|
72
|
|
|
|
|
377
|
$self->YYData->{INPUT} = shift; |
154
|
72
|
|
|
|
|
853
|
$self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|