forked from stereocat/Cisco-AccessList-Parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check3.pl
executable file
·57 lines (42 loc) · 1.49 KB
/
check3.pl
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
# -*- cperl -*-
use lib qw(.);
use strict;
use warnings;
use Parse::Eyapp;
use Test::More;
use Test::Warn;
use Data::Dumper;
use Cisco::AccessList::Parser;
#sub TERMINAL::info { $_[0]{attr} }
plan tests => 1;
my $input = << "EOACL";
access-list 100 permit tcp any any eq isakmp
EOACL
my $aclparser = Cisco::AccessList::Parser->new();
my $data = $input;
my $debug = 0;
my ( $acl, $objgrp );
warnings_exist {
( $acl, $objgrp ) = $aclparser->parse( 'input' => $data );
} ["/WARNING/"], $data;
# print "RESULT: ", ( keys(%$acl) + keys(%$objgrp) ), "\n";
# print "==================\n";
# $aclparser->lex_check( 'input' => $test_data );
__END__
access-list 100 permit 256 host 192.168.0.1 10.1.0.2
~~~ ~~~~~~~~~
複数箇所のエラー: 複数エラーの出力/テストをどうハンドリングするか
----------------------------------------
In state 40:
Stack: 0->'EXTACL'->12->'dynamic_spec'->27->'action'->69->'NUMBER'->40
Don't need token.
Reduce using rule 31 (ip_proto --> NUMBER): WARNING: Syntax error, near: >end-of-input<.
Expected one of these tokens: HOST IPV4_ADDR ANY
Back to state 69, then go to state 229.
----------------------------------------
In state 229:
Stack: 0->'EXTACL'->12->'dynamic_spec'->27->'action'->69->'ip_proto'->229
Need token. Got >HOST<
Shift and go to state 77.
----------------------------------------
数値チェックで yyerror がよばれているけど ip_proto は受理されてしまっている