blib/lib/Chemistry/File/SLN/Parser.pm

filter: Statementstmt 100% 10 / 10 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 13 / 13 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Chemistry-Mol-0.35/t/safe_clone.t ↑ Summary
1 ####################################################################
2 #
3 # This file was generated using Parse::Yapp version 1.05.
4 #
5 # Don't edit this file, use source file instead.
6 #
7 # ANY CHANGE MADE HERE WILL BE LOST !
8 #
9 ####################################################################
10 package Chemistry::File::SLN::Parser;
11 9 ▶use vars qw ( @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 9 @ISA= qw ( Parse::Yapp::Driver );
15 9 ▶use Parse::Yapp::Driver;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 #line 3 "Parser.yp"
18 no warnings 'uninitialized';
19  
20 sub new {
21 my($class)=shift;
22 ref($class)
23 and $class=ref($class);
24  
25 my($self)=$class->SUPER::new( yyversion => '1.05',
26 yystates =>
27 [
28 {#State 0
29 ACTIONS => {
30 'H' => 1,
31 "<" => 4,
32 'UC_NON_H' => 6
33 },
34 DEFAULT => -34,
35 GOTOS => {
36 'symbol' => 3,
37 'UC' => 2,
38 'atom' => 5,
39 'ctab' => 8,
40 'ctab_bracket' => 7
41 }
42 },
43 {#State 1
44 DEFAULT => -21
45 },
46 {#State 2
47 DEFAULT => -18,
48 GOTOS => {
49 'lc_str' => 9
50 }
51 },
52 {#State 3
53 ACTIONS => {
54 "[" => 11
55 },
56 DEFAULT => -28,
57 GOTOS => {
58 'atom_bracket' => 10
59 }
60 },
61 {#State 4
62 ACTIONS => {
63 'H' => 1,
64 "-" => 12,
65 'LC' => 15,
66 "+" => 16,
67 'UC_NON_H' => 6
68 },
69 DEFAULT => -39,
70 GOTOS => {
71 'UC' => 13,
72 'charge' => 20,
73 'key_val' => 14,
74 'attr_list' => 17,
75 'ALPHA' => 21,
76 'attr' => 18,
77 'key' => 19
78 }
79 },
80 {#State 5
81 ACTIONS => {
82 '' => -3,
83 "-" => 23,
84 ":" => 22,
85 "<" => -3,
86 "=" => 24,
87 "(" => 26,
88 "#" => 29,
89 "." => 30
90 },
91 DEFAULT => -8,
92 GOTOS => {
93 'bond' => 25,
94 'chain' => 28,
95 'bondatom' => 27,
96 'bond_symbol' => 31
97 }
98 },
99 {#State 6
100 DEFAULT => -20
101 },
102 {#State 7
103 DEFAULT => -1
104 },
105 {#State 8
106 ACTIONS => {
107 '' => 32
108 }
109 },
110 {#State 9
111 ACTIONS => {
112 'LC' => 33
113 },
114 DEFAULT => -17
115 },
116 {#State 10
117 ACTIONS => {
118 'H' => 34
119 },
120 DEFAULT => -36,
121 GOTOS => {
122 'hcount' => 35
123 }
124 },
125 {#State 11
126 ACTIONS => {
127 'NUM' => 37,
128 'H' => 1,
129 "-" => 12,
130 'LC' => 15,
131 "+" => 16,
132 'UC_NON_H' => 6
133 },
134 DEFAULT => -39,
135 GOTOS => {
136 'UC' => 13,
137 'charge' => 20,
138 'key_val' => 14,
139 'attr_list' => 17,
140 'ALPHA' => 21,
141 'attr' => 36,
142 'key' => 19
143 }
144 },
145 {#State 12
146 ACTIONS => {
147 'NUM' => 38
148 },
149 DEFAULT => -54
150 },
151 {#State 13
152 DEFAULT => -22
153 },
154 {#State 14
155 DEFAULT => -41
156 },
157 {#State 15
158 DEFAULT => -23
159 },
160 {#State 16
161 ACTIONS => {
162 'NUM' => 39
163 },
164 DEFAULT => -53
165 },
166 {#State 17
167 ACTIONS => {
168 ";" => 40
169 },
170 DEFAULT => -40
171 },
172 {#State 18
173 ACTIONS => {
174 ">" => 41
175 }
176 },
177 {#State 19
178 ACTIONS => {
179 "=" => 42
180 },
181 DEFAULT => -44
182 },
183 {#State 20
184 DEFAULT => -45
185 },
186 {#State 21
187 DEFAULT => -49,
188 GOTOS => {
189 'key_tail' => 43
190 }
191 },
192 {#State 22
193 DEFAULT => -15
194 },
195 {#State 23
196 DEFAULT => -11
197 },
198 {#State 24
199 DEFAULT => -12
200 },
201 {#State 25
202 ACTIONS => {
203 'H' => 1,
204 "\@" => 44,
205 'UC_NON_H' => 6
206 },
207 GOTOS => {
208 'symbol' => 3,
209 'UC' => 2,
210 'atom' => 46,
211 'closure' => 45
212 }
213 },
214 {#State 26
215 ACTIONS => {
216 "-" => 23,
217 ":" => 22,
218 "=" => 24,
219 "#" => 29,
220 "." => 30
221 },
222 DEFAULT => -8,
223 GOTOS => {
224 'bond' => 25,
225 'bondatom' => 47,
226 'bond_symbol' => 31
227 }
228 },
229 {#State 27
230 ACTIONS => {
231 "-" => 23,
232 ":" => 22,
233 "\@" => -8,
234 'UC_NON_H' => -8,
235 "=" => 24,
236 'H' => -8,
237 "(" => 26,
238 "#" => 29,
239 "." => 30
240 },
241 DEFAULT => -3,
242 GOTOS => {
243 'bond' => 25,
244 'chain' => 48,
245 'bondatom' => 27,
246 'bond_symbol' => 31
247 }
248 },
249 {#State 28
250 ACTIONS => {
251 "<" => 4
252 },
253 DEFAULT => -34,
254 GOTOS => {
255 'ctab_bracket' => 49
256 }
257 },
258 {#State 29
259 DEFAULT => -13
260 },
261 {#State 30
262 DEFAULT => -14
263 },
264 {#State 31
265 ACTIONS => {
266 "[" => 51
267 },
268 DEFAULT => -32,
269 GOTOS => {
270 'bond_bracket' => 50
271 }
272 },
273 {#State 32
274 DEFAULT => 0
275 },
276 {#State 33
277 DEFAULT => -19
278 },
279 {#State 34
280 ACTIONS => {
281 'NUM' => 52
282 },
283 DEFAULT => -38
284 },
285 {#State 35
286 DEFAULT => -16
287 },
288 {#State 36
289 ACTIONS => {
290 "]" => 53
291 }
292 },
293 {#State 37
294 ACTIONS => {
295 ":" => 54,
296 "]" => 55
297 }
298 },
299 {#State 38
300 DEFAULT => -52
301 },
302 {#State 39
303 DEFAULT => -51
304 },
305 {#State 40
306 ACTIONS => {
307 'H' => 1,
308 "-" => 12,
309 'LC' => 15,
310 "+" => 16,
311 'UC_NON_H' => 6
312 },
313 GOTOS => {
314 'UC' => 13,
315 'charge' => 20,
316 'key_val' => 56,
317 'ALPHA' => 21,
318 'key' => 19
319 }
320 },
321 {#State 41
322 DEFAULT => -35
323 },
324 {#State 42
325 ACTIONS => {
326 'STRING' => 59
327 },
328 DEFAULT => -55,
329 GOTOS => {
330 'value' => 57,
331 'string' => 58
332 }
333 },
334 {#State 43
335 ACTIONS => {
336 'LC' => 15,
337 'UC_NON_H' => 6,
338 "_" => 62,
339 'NUM' => 63,
340 'H' => 1
341 },
342 DEFAULT => -48,
343 GOTOS => {
344 'WORD' => 61,
345 'ALNUM' => 60,
346 'UC' => 13,
347 'ALPHA' => 64
348 }
349 },
350 {#State 44
351 ACTIONS => {
352 'NUM' => 65
353 }
354 },
355 {#State 45
356 DEFAULT => -7
357 },
358 {#State 46
359 DEFAULT => -6
360 },
361 {#State 47
362 ACTIONS => {
363 "-" => 23,
364 ":" => 22,
365 "=" => 24,
366 "(" => 26,
367 "#" => 29,
368 "." => 30,
369 ")" => -3
370 },
371 DEFAULT => -8,
372 GOTOS => {
373 'bond' => 25,
374 'chain' => 66,
375 'bondatom' => 27,
376 'bond_symbol' => 31
377 }
378 },
379 {#State 48
380 DEFAULT => -4
381 },
382 {#State 49
383 DEFAULT => -2
384 },
385 {#State 50
386 DEFAULT => -9
387 },
388 {#State 51
389 ACTIONS => {
390 'H' => 1,
391 "-" => 12,
392 'LC' => 15,
393 "+" => 16,
394 'UC_NON_H' => 6
395 },
396 DEFAULT => -39,
397 GOTOS => {
398 'UC' => 13,
399 'charge' => 20,
400 'key_val' => 14,
401 'attr_list' => 17,
402 'ALPHA' => 21,
403 'attr' => 67,
404 'key' => 19
405 }
406 },
407 {#State 52
408 DEFAULT => -37
409 },
410 {#State 53
411 DEFAULT => -30
412 },
413 {#State 54
414 ACTIONS => {
415 'H' => 1,
416 "-" => 12,
417 'LC' => 15,
418 "+" => 16,
419 'UC_NON_H' => 6
420 },
421 DEFAULT => -39,
422 GOTOS => {
423 'UC' => 13,
424 'charge' => 20,
425 'key_val' => 14,
426 'attr_list' => 17,
427 'ALPHA' => 21,
428 'attr' => 68,
429 'key' => 19
430 }
431 },
432 {#State 55
433 DEFAULT => -31
434 },
435 {#State 56
436 DEFAULT => -42
437 },
438 {#State 57
439 DEFAULT => -43
440 },
441 {#State 58
442 ACTIONS => {
443 "-" => 69,
444 'LC' => 15,
445 "+" => 71,
446 'UC_NON_H' => 6,
447 "_" => 62,
448 'NUM' => 63,
449 'H' => 1,
450 'OTHER_CHAR' => 74,
451 "." => 73
452 },
453 DEFAULT => -47,
454 GOTOS => {
455 'ALNUM' => 60,
456 'WORD' => 70,
457 'UC' => 13,
458 'ALPHA' => 64,
459 'string_char' => 72
460 }
461 },
462 {#State 59
463 DEFAULT => -46
464 },
465 {#State 60
466 DEFAULT => -26
467 },
468 {#State 61
469 DEFAULT => -50
470 },
471 {#State 62
472 DEFAULT => -27
473 },
474 {#State 63
475 DEFAULT => -25
476 },
477 {#State 64
478 DEFAULT => -24
479 },
480 {#State 65
481 DEFAULT => -10
482 },
483 {#State 66
484 ACTIONS => {
485 ")" => 75
486 }
487 },
488 {#State 67
489 ACTIONS => {
490 "]" => 76
491 }
492 },
493 {#State 68
494 ACTIONS => {
495 "]" => 77
496 }
497 },
498 {#State 69
499 DEFAULT => -60
500 },
501 {#State 70
502 DEFAULT => -57
503 },
504 {#State 71
505 DEFAULT => -59
506 },
507 {#State 72
508 DEFAULT => -56
509 },
510 {#State 73
511 DEFAULT => -61
512 },
513 {#State 74
514 DEFAULT => -58
515 },
516 {#State 75
517 ACTIONS => {
518 "-" => 23,
519 ":" => 22,
520 "\@" => -8,
521 'UC_NON_H' => -8,
522 "=" => 24,
523 'H' => -8,
524 "(" => 26,
525 "#" => 29,
526 "." => 30
527 },
528 DEFAULT => -3,
529 GOTOS => {
530 'bond' => 25,
531 'chain' => 78,
532 'bondatom' => 27,
533 'bond_symbol' => 31
534 }
535 },
536 {#State 76
537 DEFAULT => -33
538 },
539 {#State 77
540 DEFAULT => -29
541 },
542 {#State 78
543 DEFAULT => -5
544 }
545 ],
546 yyrules =>
547 [
548 [#Rule 0
549 '$start', 2, undef
550 ],
551 [#Rule 1
552 'ctab', 1,
553 sub
554 #line 10 "Parser.yp"
555 { +{ chain => [], attr => $_[1] } }
556 ],
557 [#Rule 2
558 'ctab', 3,
559 sub
560 #line 11 "Parser.yp"
561 { +{ chain => [ $_[1], @{$_[2]} ],
562 attr => $_[3] } }
563 ],
564 [#Rule 3
565 'chain', 0,
566 sub
567 #line 14 "Parser.yp"
568 { [] }
569 ],
570 [#Rule 4
571 'chain', 2,
572 sub
573 #line 15 "Parser.yp"
574 { [ @{$_[1]}, @{$_[2]}, ] }
575 ],
576 [#Rule 5
577 'chain', 5,
578 sub
579 #line 16 "Parser.yp"
580 {
581 [ $_[1], @{$_[2]}, @{$_[3]}, $_[4], @{$_[5]} ] }
582 ],
583 [#Rule 6
584 'bondatom', 2,
585 sub
586 #line 20 "Parser.yp"
587 { [@_[1,2]]}
588 ],
589 [#Rule 7
590 'bondatom', 2,
591 sub
592 #line 21 "Parser.yp"
593 { [@_[1,2]]}
594 ],
595 [#Rule 8
596 'bond', 0,
597 sub
598 #line 24 "Parser.yp"
599 { +{type => '-'} }
600 ],
601 [#Rule 9
602 'bond', 2,
603 sub
604 #line 25 "Parser.yp"
605 { +{
606 type => $_[1],
607 attr => $_[2]
608 }
609 }
610 ],
611 [#Rule 10
612 'closure', 2,
613 sub
614 #line 32 "Parser.yp"
615 { +{closure => $_[2]} }
616 ],
617 [#Rule 11
618 'bond_symbol', 1, undef
619 ],
620 [#Rule 12
621 'bond_symbol', 1, undef
622 ],
623 [#Rule 13
624 'bond_symbol', 1, undef
625 ],
626 [#Rule 14
627 'bond_symbol', 1, undef
628 ],
629 [#Rule 15
630 'bond_symbol', 1, undef
631 ],
632 [#Rule 16
633 'atom', 3,
634 sub
635 #line 37 "Parser.yp"
636 { +{
637 symbol => $_[1],
638 id => $_[2][0],
639 hcount => $_[3],
640 attr => $_[2][1],
641 }
642 }
643 ],
644 [#Rule 17
645 'symbol', 2,
646 sub
647 #line 46 "Parser.yp"
648 { $_[1] . $_[2] }
649 ],
650 [#Rule 18
651 'lc_str', 0, undef
652 ],
653 [#Rule 19
654 'lc_str', 2,
655 sub
656 #line 50 "Parser.yp"
657 { $_[1] . $_[2] }
658 ],
659 [#Rule 20
660 'UC', 1, undef
661 ],
662 [#Rule 21
663 'UC', 1, undef
664 ],
665 [#Rule 22
666 'ALPHA', 1, undef
667 ],
668 [#Rule 23
669 'ALPHA', 1, undef
670 ],
671 [#Rule 24
672 'ALNUM', 1, undef
673 ],
674 [#Rule 25
675 'ALNUM', 1, undef
676 ],
677 [#Rule 26
678 'WORD', 1, undef
679 ],
680 [#Rule 27
681 'WORD', 1, undef
682 ],
683 [#Rule 28
684 'atom_bracket', 0, undef
685 ],
686 [#Rule 29
687 'atom_bracket', 5,
688 sub
689 #line 59 "Parser.yp"
690 { [@_[2,4]] }
691 ],
692 [#Rule 30
693 'atom_bracket', 3,
694 sub
695 #line 60 "Parser.yp"
696 { [undef, $_[2]] }
697 ],
698 [#Rule 31
699 'atom_bracket', 3,
700 sub
701 #line 61 "Parser.yp"
702 { [$_[2], undef] }
703 ],
704 [#Rule 32
705 'bond_bracket', 0, undef
706 ],
707 [#Rule 33
708 'bond_bracket', 3,
709 sub
710 #line 65 "Parser.yp"
711 { $_[2] }
712 ],
713 [#Rule 34
714 'ctab_bracket', 0, undef
715 ],
716 [#Rule 35
717 'ctab_bracket', 3,
718 sub
719 #line 69 "Parser.yp"
720 { $_[2] }
721 ],
722 [#Rule 36
723 'hcount', 0, undef
724 ],
725 [#Rule 37
726 'hcount', 2,
727 sub
728 #line 73 "Parser.yp"
729 { $_[2] }
730 ],
731 [#Rule 38
732 'hcount', 1,
733 sub
734 #line 74 "Parser.yp"
735 { 1 }
736 ],
737 [#Rule 39
738 'attr', 0, undef
739 ],
740 [#Rule 40
741 'attr', 1, undef
742 ],
743 [#Rule 41
744 'attr_list', 1, undef
745 ],
746 [#Rule 42
747 'attr_list', 3,
748 sub
749 #line 81 "Parser.yp"
750 { +{%{$_[1]}, %{$_[3]}} }
751 ],
752 [#Rule 43
753 'key_val', 3,
754 sub
755 #line 84 "Parser.yp"
756 { +{lc($_[1]) => $_[3]} }
757 ],
758 [#Rule 44
759 'key_val', 1,
760 sub
761 #line 85 "Parser.yp"
762 { +{lc($_[1]) => 'TRUE' } }
763 ],
764 [#Rule 45
765 'key_val', 1,
766 sub
767 #line 86 "Parser.yp"
768 { +{charge => $_[1] } }
769 ],
770 [#Rule 46
771 'value', 1, undef
772 ],
773 [#Rule 47
774 'value', 1, undef
775 ],
776 [#Rule 48
777 'key', 2,
778 sub
779 #line 91 "Parser.yp"
780 { $_[1] . $_[2] }
781 ],
782 [#Rule 49
783 'key_tail', 0, undef
784 ],
785 [#Rule 50
786 'key_tail', 2,
787 sub
788 #line 94 "Parser.yp"
789 { $_[1] . $_[2] }
790 ],
791 [#Rule 51
792 'charge', 2,
793 sub
794 #line 97 "Parser.yp"
795 { $_[2] }
796 ],
797 [#Rule 52
798 'charge', 2,
799 sub
800 #line 98 "Parser.yp"
801 { -$_[2] }
802 ],
803 [#Rule 53
804 'charge', 1,
805 sub
806 #line 99 "Parser.yp"
807 { 1 }
808 ],
809 [#Rule 54
810 'charge', 1,
811 sub
812 #line 100 "Parser.yp"
813 { -1 }
814 ],
815 [#Rule 55
816 'string', 0, undef
817 ],
818 [#Rule 56
819 'string', 2,
820 sub
821 #line 104 "Parser.yp"
822 { $_[1] . $_[2] }
823 ],
824 [#Rule 57
825 'string_char', 1, undef
826 ],
827 [#Rule 58
828 'string_char', 1, undef
829 ],
830 [#Rule 59
831 'string_char', 1, undef
832 ],
833 [#Rule 60
834 'string_char', 1, undef
835 ],
836 [#Rule 61
837 'string_char', 1, undef
838 ]
839 ],
840 @_);
841 bless($self,$class);
842 }
843  
844 #line 112 "Parser.yp"
845  
846  
847 sub _Error {
848 exists $_[0]->YYData->{ERRMSG}
849 and do {
850 warn $_[0]->YYData->{ERRMSG};
851 delete $_[0]->YYData->{ERRMSG};
852 return;
853 };
854 warn "Syntax error.\n";
855 }
856  
857 sub _Lexer {
858 my($parser)=shift;
859  
860 $parser->YYData->{INPUT}
861 #or $parser->YYData->{INPUT} = <STDIN>
862 or return('',undef);
863  
864 $parser->YYData->{INPUT}=~s/^[ \t]//;
865  
866 for ($parser->YYData->{INPUT}) {
867 s/^([0-9]+(?:\.[0-9]+)?)//
868 and return('NUM',$1);
869 s/^(H)//
870 and return('H',$1);
871 s/^([A-Z])//
872 and return('UC_NON_H',$1);
873 s/^([a-z])//
874 and return('LC',$1);
875 s/^"(.*?)"//s
876 and return('STRING',$1);
877 s/^([<>[\];=_()\@#.:+-])//s
878 and return($1,$1); # "special" character
879 s/^(.)//s
880 and return('OTHER_CHAR',$1);
881 }
882 }
883  
884 sub run {
885 my($self)=shift;
886 $self->YYData->{INPUT} = shift;
887 $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
888 }
889  
890  
891 1;
« Chemistry-Mol-0.35/t/safe_clone.t ↑ Summary