34 |
if ($in =~ s/^\s*Section\s+\"([^\"]+)\"\s*$//) { |
if ($in =~ s/^\s*Section\s+\"([^\"]+)\"\s*$//) { |
35 |
$atom->{type} = 'SECTION'; |
$atom->{type} = 'SECTION'; |
36 |
$atom->{section_name} = $1; |
$atom->{section_name} = $1; |
37 |
|
$atom->{sections} = [ @{$out->{current_sections}} ]; |
38 |
push @{$out->{current_sections}}, { name => $1 }; |
push @{$out->{current_sections}}, { name => $1 }; |
39 |
$matched = 1; |
$matched = 1; |
40 |
} |
} |
43 |
if ($in =~ s/^\s*Sub[s|S]ection\s+\"([^\"]+)\"\s*$//) { |
if ($in =~ s/^\s*Sub[s|S]ection\s+\"([^\"]+)\"\s*$//) { |
44 |
$atom->{type} = 'SECTION'; |
$atom->{type} = 'SECTION'; |
45 |
$atom->{section_name} = $1; |
$atom->{section_name} = $1; |
46 |
|
$atom->{sections} = [ @{$out->{current_sections}} ]; |
47 |
push @{$out->{current_sections}}, { name => $1 }; |
push @{$out->{current_sections}}, { name => $1 }; |
48 |
$matched = 1; |
$matched = 1; |
49 |
} |
} |
51 |
q( |
q( |
52 |
if ($in =~ s/^\s*EndSub[s|S]ection\s*$//) { |
if ($in =~ s/^\s*EndSub[s|S]ection\s*$//) { |
53 |
$atom->{type} = 'ENDSECTION'; |
$atom->{type} = 'ENDSECTION'; |
54 |
|
$atom->{sections} = [ @{$out->{current_sections}} ]; |
55 |
pop @{$out->{current_sections}}; |
pop @{$out->{current_sections}}; |
56 |
$matched = 1; |
$matched = 1; |
57 |
} |
} |
59 |
q( |
q( |
60 |
if ($in =~ s/^\s*EndSection\s*$//) { |
if ($in =~ s/^\s*EndSection\s*$//) { |
61 |
$atom->{type} = 'ENDSECTION'; |
$atom->{type} = 'ENDSECTION'; |
62 |
|
$atom->{sections} = [ @{$out->{current_sections}} ]; |
63 |
pop @{$out->{current_sections}}; |
pop @{$out->{current_sections}}; |
64 |
$matched = 1; |
$matched = 1; |
65 |
} |
} |
72 |
$tmp =~ s/^\s*"([^"]*)"// and $atom->{key} = $1; |
$tmp =~ s/^\s*"([^"]*)"// and $atom->{key} = $1; |
73 |
$tmp =~ s/^\s*"([^"]*)"// and $atom->{value} = $1; |
$tmp =~ s/^\s*"([^"]*)"// and $atom->{value} = $1; |
74 |
$in = $tmp; #to allow the engine to check if some stuff were not interpreted |
$in = $tmp; #to allow the engine to check if some stuff were not interpreted |
75 |
$out->{current_sections} and $atom->{sections} = [ @{$out->{current_sections}} ]; |
$atom->{sections} = [ @{$out->{current_sections}} ]; |
76 |
$matched = 1; |
$matched = 1; |
77 |
} |
} |
78 |
), |
), |
81 |
$atom->{type} = 'KEY_VALUE'; |
$atom->{type} = 'KEY_VALUE'; |
82 |
$atom->{key} = $1; |
$atom->{key} = $1; |
83 |
$atom->{value} = $2; |
$atom->{value} = $2; |
84 |
$out->{current_sections} and $atom->{sections} = [ @{$out->{current_sections}} ]; |
$atom->{sections} = [ @{$out->{current_sections}} ]; |
85 |
$matched = 1; |
$matched = 1; |
86 |
} |
} |
87 |
), |
), |
115 |
$index = (findAtomPos($out, \%args_search))[-1]; |
$index = (findAtomPos($out, \%args_search))[-1]; |
116 |
$index or return -2; |
$index or return -2; |
117 |
} |
} |
118 |
$args{section_name} and @{$out->{atoms}}[$index]->{section_names} = $args{section_name}; |
exists $args{section_name} and @{$out->{atoms}}[$index]->{section_names} = $args{section_name}; |
119 |
$args{type} and @{$out->{atoms}}[$index]->{type} = $args{type}; |
exists $args{type} and @{$out->{atoms}}[$index]->{type} = $args{type}; |
120 |
$args{key} and @{$out->{atoms}}[$index]->{key} = $args{key}; |
exists $args{key} and @{$out->{atoms}}[$index]->{key} = $args{key}; |
121 |
$args{value} and @{$out->{atoms}}[$index]->{value} = $args{value}; |
exists $args{value} and @{$out->{atoms}}[$index]->{value} = $args{value}; |
122 |
$args{list} and @{$out->{atoms}}[$index]->{list} = [ @{$args{list}} ]; |
exists $args{list} and @{$out->{atoms}}[$index]->{list} = [ @{$args{list}} ]; |
123 |
|
exists $args{sections} and @{$out->{atoms}}[$index]->{sections} [ @{$args{sections}} ]; |
124 |
|
@{$out->{atoms}}[$index]->{sections} ||= [ ]; |
125 |
|
return $index; |
126 |
), |
), |
127 |
find_atom_pos => q( |
find_atom_pos => q( |
128 |
my $i = 0; |
my $i = 0; |
136 |
$flag or next; |
$flag or next; |
137 |
if (exists $args{sections}) { |
if (exists $args{sections}) { |
138 |
exists $atom->{sections} or next; |
exists $atom->{sections} or next; |
139 |
@{$args{sections}} == @{$atom->{sections}} or next; |
$flag = compare_depth($args{sections}, $atom->{sections}); |
|
foreach my $i (0..@{$args{sections}}-1) { |
|
|
@{$atom->{sections}}[$i]->{name} eq @{$args{sections}}[$i]->{name} or $flag = 0; |
|
|
} |
|
140 |
} |
} |
141 |
$flag or next; |
$flag or next; |
142 |
if (exists $args{list}) { |
if (exists $args{list}) { |
143 |
exists $atom->{list} or next; |
exists $atom->{list} or next; |
144 |
@{$args{list}} == @{$atom->{list}} or next; |
@{$args{list}} == @{$atom->{list}} or next; |