| 1 | # | ||||||||||||||||||||||||||||
| 2 | # Interface Definition Language (OMG IDL CORBA v3.0) | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # Lexer module | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | package CORBA::IDL::Lexer; | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | our $VERSION = '2.64'; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Math::BigInt; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Math::BigFloat; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub _StringLexer { | ||||||||||||||||||||||||||
|
Subroutine
_StringLexer: not called CC=21 SCAR=61.4
| |||||||||||||||||||||||||||||
| 18 | 0 | my ($parser, $token) = @_; | |||||||||||||||||||||||||||
| 19 | 0 | my $str = q{}; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | while ($parser->YYData->{line}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | for ($parser->YYData->{line}) { | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | s/^\"// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | and return ($token, $str); | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | s/^([^"\\]+)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | and $str .= $1, # any character except single quote or backslash | ||||||||||||||||||||||||||||
| 30 | last; | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | s/^\\a// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | and $str .= "\a", # alert | ||||||||||||||||||||||||||||
| 34 | last; | ||||||||||||||||||||||||||||
| 35 | 0 | ▶ | s/^\\b// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | and $str .= "\b", # backspace | ||||||||||||||||||||||||||||
| 37 | last; | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | s/^\\f// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | and $str .= "\f", # form feed | ||||||||||||||||||||||||||||
| 40 | last; | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | s/^\\n// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | and $str .= "\n", # new line | ||||||||||||||||||||||||||||
| 43 | last; | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | s/^\\r// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | and $str .= "\r", # carriage return | ||||||||||||||||||||||||||||
| 46 | last; | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | s/^\\t// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | and $str .= "\t", # horizontal tab | ||||||||||||||||||||||||||||
| 49 | last; | ||||||||||||||||||||||||||||
| 50 | 0 | ▶ | s/^\\v// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | and $str .= "\013", # vertical tab | ||||||||||||||||||||||||||||
| 52 | last; | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | s/^\\([\?'"])// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | and $str .= $1, # backslash, question mark, single quote, double quote | ||||||||||||||||||||||||||||
| 55 | last; | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | s/^\\([0-7]{1,3})// | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 58 | and $str .= chr oct $1, | ||||||||||||||||||||||||||||
| 59 | (oct $1) ? 1 : $parser->Error("null character in a string.\n"), | ||||||||||||||||||||||||||||
| 60 | last; | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | s/^\\x([0-9A-Fa-f]{1,2})// | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 62 | and $str .= chr hex $1, | ||||||||||||||||||||||||||||
| 63 | (hex $1) ? 1 : $parser->Error("null character in a string.\n"), | ||||||||||||||||||||||||||||
| 64 | last; | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if ($token eq 'WIDE_STRING_LITERAL') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | ▶ | s/^\\u([0-9A-Fa-f]{1,4})// | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 67 | and $str .= chr hex $1, | ||||||||||||||||||||||||||||
| 68 | (hex $1) ? 1 : $parser->Error("null character in a string.\n"), | ||||||||||||||||||||||||||||
| 69 | last; | ||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | s/^\\// | ||||||||||||||||||||||||||||
| 72 | 0 | ▶ | and $parser->Error("invalid escape sequence.\n"), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | last | ||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | $parser->Error("untermined string.\n"); | |||||||||||||||||||||||||||
| 78 | 0 | $parser->YYData->{lineno} ++; | |||||||||||||||||||||||||||
| 79 | 0 | return ($token, $str); | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub _CharLexer { | ||||||||||||||||||||||||||
|
Subroutine
_CharLexer: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||||||||
| 83 | 0 | my ($parser, $token) = @_; | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | $_ = $parser->YYData->{line}; | |||||||||||||||||||||||||||
| 86 | 0 | ▶ | s/^([^'\\])\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | and return ($token, $1); # any character except single quote or backslash | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | s/^\\n\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | and return ($token, "\n"); # new line | ||||||||||||||||||||||||||||
| 91 | 0 | ▶ | s/^\\t\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | and return ($token, "\t"); # horizontal tab | ||||||||||||||||||||||||||||
| 93 | 0 | ▶ | s/^\\v\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | and return ($token, "\013"); # vertical tab | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | s/^\\b\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | and return ($token, "\b"); # backspace | ||||||||||||||||||||||||||||
| 97 | 0 | ▶ | s/^\\r\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | and return ($token, "\r"); # carriage return | ||||||||||||||||||||||||||||
| 99 | 0 | ▶ | s/^\\f\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | and return ($token, "\f"); # form feed | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | s/^\\a\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | and return ($token, "\a"); # alert | ||||||||||||||||||||||||||||
| 103 | 0 | ▶ | s/^\\([\?'"])\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | and return ($token, $1); # backslash, question mark, single quote, double quote | ||||||||||||||||||||||||||||
| 105 | 0 | ▶ | s/^\\([0-7]{1,3})\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | and return ($token, chr oct $1); | ||||||||||||||||||||||||||||
| 107 | 0 | ▶ | s/^\\x([0-9A-Fa-f]{1,2})\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | and return ($token, chr hex $1); | ||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ($token eq 'WIDE_STRING_LITERAL') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | ▶ | s/^\\u([0-9A-Fa-f]{1,4})\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | and return ($token, chr hex $1); | ||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | s/^\\([^\s\(\)\[\]\{\}<>,;:="]*)// | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | and $parser->Error("invalid escape sequence $1.\n"), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | return ($token, ' '); | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | s/^([^\s\(\)\[\]\{\}<>,;:="]*)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | and $parser->Error("invalid character $1.\n"), | ||||||||||||||||||||||||||||
| 120 | return ($token, q{ }); | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 0 | print "INTERNAL_ERROR:_CharLexer $_\n"; | |||||||||||||||||||||||||||
| 123 | 0 | return ($token, q{ }); | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub _Identifier { | ||||||||||||||||||||||||||
|
Subroutine
_Identifier: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 127 | 0 | my ($parser, $ident) = @_; | |||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 0 | my $key = uc $ident; | |||||||||||||||||||||||||||
| 130 | 0 | ▶ | if (exists $parser->YYData->{keyword}{$key}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | 0 | my ($keywd, $version, $lang) = @{$parser->YYData->{keyword}{$key}}; | |||||||||||||||||||||||||||
| 132 | 0 | ▶ | if ($CORBA::IDL::Parser::IDL_VERSION ge $version) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if ($ident eq $keywd) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | 0 | return ($key, $ident); | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | else { | ||||||||||||||||||||||||||||
| 137 | 0 | $parser->Error("'$ident' collides with keyword '$keywd'.\n"); | |||||||||||||||||||||||||||
| 138 | 0 | return ('IDENTIFIER', $ident); | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | else { | ||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if (defined $lang) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ($ident eq $keywd) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | $parser->Info("'$ident' is a keyword of $lang.\n"); | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | else { | ||||||||||||||||||||||||||||
| 147 | 0 | $parser->Info("'$ident' collides with keyword '$keywd' of $lang.\n"); | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | else { | ||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if ($ident eq $keywd) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 0 | $parser->Info("'$ident' is a future keyword.\n"); | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | else { | ||||||||||||||||||||||||||||
| 155 | 0 | $parser->Info("'$ident' collides with future keyword '$keywd'.\n"); | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | 0 | return ('IDENTIFIER', $ident); | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub _EscIdentifier { | ||||||||||||||||||||||||||
|
Subroutine
_EscIdentifier: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 164 | 0 | my ($parser, $ident) = @_; | |||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if ($CORBA::IDL::Parser::IDL_VERSION ge '2.3') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 0 | my $key = uc $ident; | |||||||||||||||||||||||||||
| 168 | 0 | ▶ | unless (exists $parser->YYData->{keyword}{$key}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | 0 | Info("Unnecessary escaped identifier '$ident'.\n"); | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | else { | ||||||||||||||||||||||||||||
| 173 | 0 | $parser->Warning("Escaped identifier is not allowed.\n"); | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | 0 | return ('IDENTIFIER', $ident); | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | ▶ | sub _OctInteger { | ||||||||||||||||||||||||||
|
Subroutine
_OctInteger: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 179 | 0 | my ($parser, $str) = @_; | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 0 | my $val = new Math::BigInt(0); | |||||||||||||||||||||||||||
| 182 | 0 | foreach (split //, $str) { | |||||||||||||||||||||||||||
| 183 | 0 | $val = $val * new Math::BigInt(8) + new Math::BigInt(oct $_); | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | 0 | return ('INTEGER_LITERAL', $val); | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub _HexInteger { | ||||||||||||||||||||||||||
|
Subroutine
_HexInteger: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 189 | 0 | my ($parser, $str) = @_; | |||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 0 | my $val = new Math::BigInt(0); | |||||||||||||||||||||||||||
| 192 | 0 | foreach (split //, $str) { | |||||||||||||||||||||||||||
| 193 | 0 | $val = $val * new Math::BigInt(16) + new Math::BigInt(hex $_); | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | 0 | return ('INTEGER_LITERAL', $val); | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 0 | ▶ | sub _CommentLexer { | ||||||||||||||||||||||||||
|
Subroutine
_CommentLexer: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 199 | 0 | my ($parser) = @_; | |||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 0 | while (1) { | |||||||||||||||||||||||||||
| 202 | $parser->YYData->{line} | ||||||||||||||||||||||||||||
| 203 | or $parser->YYData->{line} = readline $parser->YYData->{fh} | ||||||||||||||||||||||||||||
| 204 | 0 | ▶ | or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
MC/DC0%0/2
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
$parser->YYData->{"line"}
$parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
Truth table0%0/3
A or B
A= $parser->YYData->{"line"}B= $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
| |||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 0 | for ($parser->YYData->{line}) { | |||||||||||||||||||||||||||
| 207 | s/^\n// | ||||||||||||||||||||||||||||
| 208 | 0 | ▶ | and $parser->YYData->{lineno} ++, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 209 | last; | ||||||||||||||||||||||||||||
| 210 | 0 | ▶ | s/^\*\/// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 211 | and return; | ||||||||||||||||||||||||||||
| 212 | 0 | ▶ | s/^.[^*\n]*// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | and last; | ||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 0 | ▶ | sub _DocLexer { | ||||||||||||||||||||||||||
|
Subroutine
_DocLexer: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||
| 219 | 0 | my ($parser) = @_; | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | $parser->YYData->{doc} = q{}; | |||||||||||||||||||||||||||
| 222 | 0 | my $flag = 1; | |||||||||||||||||||||||||||
| 223 | 0 | while (1) { | |||||||||||||||||||||||||||
| 224 | $parser->YYData->{line} | ||||||||||||||||||||||||||||
| 225 | or $parser->YYData->{line} = readline $parser->YYData->{fh} | ||||||||||||||||||||||||||||
| 226 | 0 | ▶ | or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
MC/DC0%0/2
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
$parser->YYData->{"line"}
$parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
Truth table0%0/3
A or B
A= $parser->YYData->{"line"}B= $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
| |||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | for ($parser->YYData->{line}) { | |||||||||||||||||||||||||||
| 229 | s/^(\n)// | ||||||||||||||||||||||||||||
| 230 | and $parser->YYData->{lineno} ++, | ||||||||||||||||||||||||||||
| 231 | 0 | ▶ | $parser->YYData->{doc} .= $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | $flag = 0, | ||||||||||||||||||||||||||||
| 233 | last; | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | s/^\r// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | and last; | ||||||||||||||||||||||||||||
| 236 | 0 | ▶ | s/^\*\/// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 237 | and return; | ||||||||||||||||||||||||||||
| 238 | 0 | ▶ | unless ($flag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | 0 | ▶ | s/^\*// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | and $flag = 1, | ||||||||||||||||||||||||||||
| 241 | last; | ||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | s/^([ \t\f\013]+)// | ||||||||||||||||||||||||||||
| 244 | 0 | ▶ | and $parser->YYData->{doc} .= $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | last; | ||||||||||||||||||||||||||||
| 246 | s/^(.[\w \t]*)// | ||||||||||||||||||||||||||||
| 247 | 0 | ▶ | and $parser->YYData->{doc} .= $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | $flag = 1, | ||||||||||||||||||||||||||||
| 249 | last; | ||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 0 | ▶ | sub _DocAfterLexer { | ||||||||||||||||||||||||||
|
Subroutine
_DocAfterLexer: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||
| 255 | 0 | my ($parser) = @_; | |||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | 0 | ▶ | unless (defined $parser->YYData->{curr_node}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 0 | $parser->_DocLexer(); | |||||||||||||||||||||||||||
| 259 | 0 | return; | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 0 | ▶ | unless (exists $parser->YYData->{curr_node}->{doc}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 263 | 0 | $parser->YYData->{curr_node}->{doc} = q{}; | |||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | 0 | my $flag = 1; | |||||||||||||||||||||||||||
| 266 | 0 | while (1) { | |||||||||||||||||||||||||||
| 267 | $parser->YYData->{line} | ||||||||||||||||||||||||||||
| 268 | or $parser->YYData->{line} = readline $parser->YYData->{fh} | ||||||||||||||||||||||||||||
| 269 | 0 | ▶ | or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
MC/DC0%0/2
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
$parser->YYData->{"line"}
$parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
Truth table0%0/3
A or B
A= $parser->YYData->{"line"}B= $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
| |||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 0 | for ($parser->YYData->{line}) { | |||||||||||||||||||||||||||
| 272 | s/^(\n)// | ||||||||||||||||||||||||||||
| 273 | and $parser->YYData->{lineno} ++, | ||||||||||||||||||||||||||||
| 274 | 0 | ▶ | $parser->YYData->{curr_node}->{doc} .= $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | $flag = 0, | ||||||||||||||||||||||||||||
| 276 | last; | ||||||||||||||||||||||||||||
| 277 | 0 | ▶ | s/^\r// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 278 | and last; | ||||||||||||||||||||||||||||
| 279 | 0 | ▶ | s/^\*\/// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | and return; | ||||||||||||||||||||||||||||
| 281 | 0 | ▶ | unless ($flag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 282 | 0 | ▶ | s/^\*// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 283 | and $flag = 1, | ||||||||||||||||||||||||||||
| 284 | last; | ||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | s/^([ \t\f\013]+)// | ||||||||||||||||||||||||||||
| 287 | 0 | ▶ | and $parser->YYData->{curr_node}->{doc} .= $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 288 | last; | ||||||||||||||||||||||||||||
| 289 | s/^(.[\w \t]*)// | ||||||||||||||||||||||||||||
| 290 | 0 | ▶ | and $parser->YYData->{curr_node}->{doc} .= $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 291 | $flag = 1, | ||||||||||||||||||||||||||||
| 292 | last; | ||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | 0 | ▶ | sub _CodeLexer { | ||||||||||||||||||||||||||
|
Subroutine
_CodeLexer: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 298 | 0 | my ($parser) = @_; | |||||||||||||||||||||||||||
| 299 | 0 | my $frag = q{}; | |||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 0 | while (1) { | |||||||||||||||||||||||||||
| 302 | $parser->YYData->{line} | ||||||||||||||||||||||||||||
| 303 | or $parser->YYData->{line} = readline $parser->YYData->{fh} | ||||||||||||||||||||||||||||
| 304 | 0 | ▶ | or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
MC/DC0%0/2
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
$parser->YYData->{"line"}
$parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
Truth table0%0/3
A or B
A= $parser->YYData->{"line"}B= $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
| |||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 0 | for ($parser->YYData->{line}) { | |||||||||||||||||||||||||||
| 307 | s/^(\n)// | ||||||||||||||||||||||||||||
| 308 | 0 | ▶ | and $parser->YYData->{lineno} ++, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 309 | $frag .= $1, | ||||||||||||||||||||||||||||
| 310 | last; | ||||||||||||||||||||||||||||
| 311 | 0 | ▶ | s/^%\}.*// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 312 | and return ('CODE_FRAGMENT', $frag); | ||||||||||||||||||||||||||||
| 313 | 0 | ▶ | s/^(.[^%\n]*)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 314 | and $frag .= $1, | ||||||||||||||||||||||||||||
| 315 | last; | ||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 0 | ▶ | sub _PragmaLexer { # 10.6.5 Pragma Directives for RepositoryId | ||||||||||||||||||||||||||
|
Subroutine
_PragmaLexer: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 321 | 0 | my ($parser, $line) = @_; | |||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | 0 | for ($line) { | |||||||||||||||||||||||||||
| 324 | s/^ID[ \t]+([0-9A-Za-z_:]+)[ \t]+\"([^\s">]+)\"// | ||||||||||||||||||||||||||||
| 325 | 0 | ▶ | and $parser->YYData->{symbtab}->PragmaID($1,$2), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 326 | return; | ||||||||||||||||||||||||||||
| 327 | s/^prefix[ \t]+\"([0-9A-Za-z_:\.\/\-]*)\"// | ||||||||||||||||||||||||||||
| 328 | 0 | ▶ | and $parser->YYData->{symbtab}->PragmaPrefix($1), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | return; | ||||||||||||||||||||||||||||
| 330 | s/^version[ \t]+([0-9A-Za-z_:]+)[ \t]+([0-9]+)\.([0-9]+)// | ||||||||||||||||||||||||||||
| 331 | 0 | ▶ | and $parser->YYData->{symbtab}->PragmaVersion($1,$2,$3), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | return; | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | 0 | $parser->Info("Non standard pragma.\n"); | |||||||||||||||||||||||||||
| 335 | 0 | return; | |||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 0 | ▶ | sub _AttachDoc { | ||||||||||||||||||||||||||
|
Subroutine
_AttachDoc: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 340 | 0 | my ($parser, $comment) = @_; | |||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 0 | ▶ | if (defined $parser->YYData->{curr_node}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if (exists $parser->YYData->{curr_node}->{doc}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 344 | 0 | $parser->YYData->{curr_node}->{doc} .= $comment; | |||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||
| 346 | else { | ||||||||||||||||||||||||||||
| 347 | 0 | $parser->YYData->{curr_node}->{doc} = $comment; | |||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 0 | ▶ | sub Lexer { | ||||||||||||||||||||||||||
|
Subroutine
Lexer: not called CC=58 SCAR=81.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 353 | 0 | my ($parser) = @_; | |||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | 0 | while (1) { | |||||||||||||||||||||||||||
| 356 | $parser->YYData->{line} | ||||||||||||||||||||||||||||
| 357 | or $parser->YYData->{line} = readline $parser->YYData->{fh} | ||||||||||||||||||||||||||||
| 358 | 0 | ▶ | or return (q{}, undef); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
MC/DC0%0/2
$parser->YYData->{"line"} or $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
$parser->YYData->{"line"}
$parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
Truth table0%0/3
A or B
A= $parser->YYData->{"line"}B= $parser->YYData->{"line"} = readline $parser->YYData->{"fh"}
| |||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | 0 | ▶ | unless (exists $parser->YYData->{srcname}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 361 | 0 | ▶ | if ($parser->YYData->{line} =~ /^#\s*(line\s+)?\d+\s+["<]([^\s">]+)[">]\s*\n/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 362 | 0 | $parser->YYData->{srcname} = $2; | |||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||
| 364 | else { | ||||||||||||||||||||||||||||
| 365 | 0 | print "INTERNAL_ERROR:_Lexer\n"; | |||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||
| 367 | 0 | ▶ | if (defined $parser->YYData->{srcname}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 368 | 0 | my @st = stat($parser->YYData->{srcname}); | |||||||||||||||||||||||||||
| 369 | 0 | $parser->YYData->{srcname_size} = $st[7]; | |||||||||||||||||||||||||||
| 370 | 0 | $parser->YYData->{srcname_mtime} = $st[9]; | |||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | 0 | for ($parser->YYData->{line}) { | |||||||||||||||||||||||||||
| 375 | 0 | ▶ | s/^#\s+[\d]+\s+"<[^>]+>"\s*\d*\s*\n// # cpp 3.2.3 ("<build-in>", "<command line> [\d]") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 376 | and last; | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | s/^#\s+([\d]+)\s+["<]([^\s">]+)[">]\s+([\d]+)\s*\n// # cpp | ||||||||||||||||||||||||||||
| 379 | and $parser->YYData->{lineno} = $1, | ||||||||||||||||||||||||||||
| 380 | $parser->YYData->{filename} = $2, | ||||||||||||||||||||||||||||
| 381 | $parser->YYData->{doc} = q{}, | ||||||||||||||||||||||||||||
| 382 | $parser->YYData->{curr_node} = undef, | ||||||||||||||||||||||||||||
| 383 | 0 | ▶ | last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | s/^#\s+([\d]+)\s+["<]([^\s">]+)[">]\s*\n// # cpp | ||||||||||||||||||||||||||||
| 386 | and $parser->YYData->{lineno} = $1, | ||||||||||||||||||||||||||||
| 387 | $parser->YYData->{filename} = $2, | ||||||||||||||||||||||||||||
| 388 | $parser->YYData->{doc} = q{}, | ||||||||||||||||||||||||||||
| 389 | $parser->YYData->{curr_node} = undef, | ||||||||||||||||||||||||||||
| 390 | 0 | ▶ | last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 391 | s/^#\s*line\s+([\d]+)\s+["<]([^\s">]+)[">]\s*\n// # CL.EXE Microsoft VC | ||||||||||||||||||||||||||||
| 392 | and $parser->YYData->{lineno} = $1, | ||||||||||||||||||||||||||||
| 393 | $parser->YYData->{filename} = $2, | ||||||||||||||||||||||||||||
| 394 | $parser->YYData->{doc} = q{}, | ||||||||||||||||||||||||||||
| 395 | $parser->YYData->{curr_node} = undef, | ||||||||||||||||||||||||||||
| 396 | 0 | ▶ | last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 0 | s/^[ \r\t\f\013]+//; # whitespaces | |||||||||||||||||||||||||||
| 399 | s/^\n// | ||||||||||||||||||||||||||||
| 400 | and $parser->YYData->{lineno} ++, | ||||||||||||||||||||||||||||
| 401 | $parser->YYData->{curr_node} = undef, | ||||||||||||||||||||||||||||
| 402 | 0 | ▶ | last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | s/^#pragma\s+(.*)\n// | ||||||||||||||||||||||||||||
| 405 | and _PragmaLexer($parser, $1), | ||||||||||||||||||||||||||||
| 406 | $parser->YYData->{lineno} ++, | ||||||||||||||||||||||||||||
| 407 | $parser->YYData->{curr_node} = undef, | ||||||||||||||||||||||||||||
| 408 | 0 | ▶ | last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | 0 | ▶ | s/^\/\*\*<// # documentation after | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 411 | and _DocAfterLexer($parser), | ||||||||||||||||||||||||||||
| 412 | last; | ||||||||||||||||||||||||||||
| 413 | 0 | ▶ | s/^\/\*\*// # documentation | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 414 | and _DocLexer($parser), | ||||||||||||||||||||||||||||
| 415 | last; | ||||||||||||||||||||||||||||
| 416 | s/^\/\/\/(.*)\n// # single line documentation | ||||||||||||||||||||||||||||
| 417 | and _AttachDoc($parser, $1), | ||||||||||||||||||||||||||||
| 418 | 0 | ▶ | and $parser->YYData->{lineno} ++, | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
s[^///(.*)\n][] and _AttachDoc($parser, $1)
MC/DC0%0/2
s[^///(.*)\n][] and _AttachDoc($parser, $1)
s[^///(.*)\n][]
_AttachDoc($parser, $1)
Truth table0%0/3
A and B
A= s[^///(.*)\n][]B= _AttachDoc($parser, $1)
| |||||||||||||||||||||||||||||
| 419 | last; | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | 0 | ▶ | s/^\/\*// # multiple line comment | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 422 | and _CommentLexer($parser), | ||||||||||||||||||||||||||||
| 423 | last; | ||||||||||||||||||||||||||||
| 424 | s/^\/\/.*\n// # single line comment | ||||||||||||||||||||||||||||
| 425 | and $parser->YYData->{lineno} ++, | ||||||||||||||||||||||||||||
| 426 | $parser->YYData->{curr_node} = undef, | ||||||||||||||||||||||||||||
| 427 | 0 | ▶ | last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | 0 | ▶ | s/^%\{// # code fragment | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 430 | and return _CodeLexer($parser); | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | 0 | ▶ | if ($parser->YYData->{prop}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 433 | 0 | ▶ | s/^([A-Za-z][0-9A-Za-z_]*)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 434 | and return ('PROP_KEY', $1); | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | 0 | ▶ | s/^\(([^\)]+)\)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 437 | and return ('PROP_VALUE', $1); | ||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | 0 | ▶ | if ($parser->YYData->{native}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 441 | 0 | ▶ | s/^([^\)]+)\)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 442 | and return ('NATIVE_TYPE', $1); | ||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||
| 445 | s/^__declspec\s*\(\s*([A-Za-z]*)\s*\)// | ||||||||||||||||||||||||||||
| 446 | 0 | ▶ | and return ('DECLSPEC', $1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | s/^([0-9]+)([Dd])// | ||||||||||||||||||||||||||||
| 449 | 0 | ▶ | and $parser->YYData->{lexeme} = $1 . $2, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 450 | return ('FIXED_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 451 | s/^([0-9]+\.)([Dd])// | ||||||||||||||||||||||||||||
| 452 | 0 | ▶ | and $parser->YYData->{lexeme} = $1 . $2, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 453 | return ('FIXED_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 454 | s/^(\.[0-9]+)([Dd])// | ||||||||||||||||||||||||||||
| 455 | 0 | ▶ | and $parser->YYData->{lexeme} = $1 . $2, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 456 | return ('FIXED_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 457 | s/^([0-9]+\.[0-9]+)([Dd])// | ||||||||||||||||||||||||||||
| 458 | 0 | ▶ | and $parser->YYData->{lexeme} = $1 . $2, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 459 | return ('FIXED_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | s/^([0-9]+\.[0-9]+[Ee][+\-]?[0-9]+)// | ||||||||||||||||||||||||||||
| 462 | 0 | ▶ | and $parser->YYData->{lexeme} = $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 463 | return ('FLOATING_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 464 | s/^([0-9]+[Ee][+\-]?[0-9]+)// | ||||||||||||||||||||||||||||
| 465 | 0 | ▶ | and $parser->YYData->{lexeme} = $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 466 | return ('FLOATING_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 467 | s/^(\.[0-9]+[Ee][+\-]?[0-9]+)// | ||||||||||||||||||||||||||||
| 468 | 0 | ▶ | and $parser->YYData->{lexeme} = $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 469 | return ('FLOATING_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 470 | s/^([0-9]+\.[0-9]+)// | ||||||||||||||||||||||||||||
| 471 | 0 | ▶ | and $parser->YYData->{lexeme} = $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 472 | return ('FLOATING_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 473 | s/^([0-9]+\.)// | ||||||||||||||||||||||||||||
| 474 | 0 | ▶ | and $parser->YYData->{lexeme} = $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 475 | return ('FLOATING_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 476 | s/^(\.[0-9]+)// | ||||||||||||||||||||||||||||
| 477 | 0 | ▶ | and $parser->YYData->{lexeme} = $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 478 | return ('FLOATING_PT_LITERAL', new Math::BigFloat($1)); | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | s/^0([0-7]+)// | ||||||||||||||||||||||||||||
| 481 | 0 | ▶ | and $parser->YYData->{lexeme} = '0' . $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 482 | return _OctInteger($parser, $1); | ||||||||||||||||||||||||||||
| 483 | s/^(0[Xx])([A-Fa-f0-9]+)// | ||||||||||||||||||||||||||||
| 484 | 0 | ▶ | and $parser->YYData->{lexeme} = $1 . $2, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 485 | return _HexInteger($parser, $2); | ||||||||||||||||||||||||||||
| 486 | s/^(0)// | ||||||||||||||||||||||||||||
| 487 | 0 | ▶ | and $parser->YYData->{lexeme} = $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 488 | return ('INTEGER_LITERAL', new Math::BigInt($1)); | ||||||||||||||||||||||||||||
| 489 | s/^([1-9][0-9]*)// | ||||||||||||||||||||||||||||
| 490 | 0 | ▶ | and $parser->YYData->{lexeme} = $1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 491 | return ('INTEGER_LITERAL', new Math::BigInt($1)); | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 0 | ▶ | s/^\"// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 494 | and return _StringLexer($parser, 'STRING_LITERAL'); | ||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if ($CORBA::IDL::Parser::IDL_VERSION ge '2.3') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 497 | 0 | ▶ | s/^L\"// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 498 | and return _StringLexer($parser, 'WIDE_STRING_LITERAL'); | ||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||
| 500 | else { | ||||||||||||||||||||||||||||
| 501 | 0 | ▶ | s/^L\"// | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
s/^L\"// and $parser->Warning("literal 'wstring' is not allowed.\n")
MC/DC0%0/2
s/^L\"// and $parser->Warning("literal 'wstring' is not allowed.\n")
s/^L\"//
$parser->Warning("literal 'wstring' is not allowed.\n")
Truth table0%0/3
A and B
A= s/^L\"//B= $parser->Warning("literal 'wstring' is not allowed.\n")
| |||||||||||||||||||||||||||||
| 502 | and $parser->Warning("literal 'wstring' is not allowed.\n") | ||||||||||||||||||||||||||||
| 503 | and return _StringLexer($parser, 'STRING_LITERAL'); | ||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | 0 | ▶ | s/^\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 507 | and return _CharLexer($parser, 'CHARACTER_LITERAL'); | ||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||
| 509 | 0 | ▶ | if ($CORBA::IDL::Parser::IDL_VERSION ge '2.3') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 510 | 0 | ▶ | s/^L\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 511 | and return _CharLexer($parser, 'WIDE_CHARACTER_LITERAL'); | ||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||
| 513 | else { | ||||||||||||||||||||||||||||
| 514 | 0 | ▶ | s/^L\'// | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
s/^L\'// and $parser->Warning("literal 'wchar' is not allowed.\n")
MC/DC0%0/2
s/^L\'// and $parser->Warning("literal 'wchar' is not allowed.\n")
s/^L\'//
$parser->Warning("literal 'wchar' is not allowed.\n")
Truth table0%0/3
A and B
A= s/^L\'//B= $parser->Warning("literal 'wchar' is not allowed.\n")
| |||||||||||||||||||||||||||||
| 515 | and $parser->Warning("literal 'wchar' is not allowed.\n") | ||||||||||||||||||||||||||||
| 516 | and return _CharLexer($parser, 'CHARACTER_LITERAL'); | ||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||
| 519 | 0 | ▶ | s/^([A-Za-z][0-9A-Za-z_]*)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 520 | and return _Identifier($parser, $1); | ||||||||||||||||||||||||||||
| 521 | 0 | ▶ | s/^_([A-Za-z][0-9A-Za-z_]*)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 522 | and return _EscIdentifier($parser, $1); | ||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | 0 | ▶ | s/^(<<)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 525 | and return ($1, $1); | ||||||||||||||||||||||||||||
| 526 | 0 | ▶ | s/^(>>)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 527 | and return ($1, $1); | ||||||||||||||||||||||||||||
| 528 | 0 | ▶ | s/^(::)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 529 | and return ($1, $1); | ||||||||||||||||||||||||||||
| 530 | 0 | ▶ | s/^(\.\.\.)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 531 | and return ($1, $1); | ||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | 0 | ▶ | s/^([\+&\/%\*~\|\-\^\(\)\[\]\{\}<>,;:=])// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 534 | and return ($1, $1); # punctuators | ||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | 0 | ▶ | s/^([\S]+)// | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 537 | and $parser->Error("lexer error $1.\n"), | ||||||||||||||||||||||||||||
| 538 | last; | ||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | 0 | ▶ | sub InitLexico { | ||||||||||||||||||||||||||
|
Subroutine
InitLexico: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 544 | 0 | my ($parser) = @_; | |||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | # 3.2.4 Keywords | ||||||||||||||||||||||||||||
| 547 | 0 | my %keywords = ( | |||||||||||||||||||||||||||
| 548 | 'ABSTRACT' => [ 'abstract', '2.3' ], | ||||||||||||||||||||||||||||
| 549 | 'ANY' => [ 'any', '2.0' ], | ||||||||||||||||||||||||||||
| 550 | 'ATTRIBUTE' => [ 'attribute', '2.0' ], | ||||||||||||||||||||||||||||
| 551 | 'BOOLEAN' => [ 'boolean', '2.0' ], | ||||||||||||||||||||||||||||
| 552 | 'BYTE' => [ 'byte', '9.9', 'MIDL/MODL' ], | ||||||||||||||||||||||||||||
| 553 | 'CASE' => [ 'case', '2.0' ], | ||||||||||||||||||||||||||||
| 554 | 'CHAR' => [ 'char', '2.0' ], | ||||||||||||||||||||||||||||
| 555 | 'COMPONENT' => [ 'component', '3.0' ], | ||||||||||||||||||||||||||||
| 556 | 'CONST' => [ 'const', '2.0' ], | ||||||||||||||||||||||||||||
| 557 | 'CONSUMES' => [ 'consumes', '3.0' ], | ||||||||||||||||||||||||||||
| 558 | 'CONTEXT' => [ 'context', '2.0' ], | ||||||||||||||||||||||||||||
| 559 | 'CUSTOM' => [ 'custom', '2.3' ], | ||||||||||||||||||||||||||||
| 560 | 'DEFAULT' => [ 'default', '2.0' ], | ||||||||||||||||||||||||||||
| 561 | 'DOUBLE' => [ 'double', '2.0' ], | ||||||||||||||||||||||||||||
| 562 | 'EMITS' => [ 'emits', '3.0' ], | ||||||||||||||||||||||||||||
| 563 | 'ENUM' => [ 'enum', '2.0' ], | ||||||||||||||||||||||||||||
| 564 | 'EVENTTYPE' => [ 'eventtype', '3.0' ], | ||||||||||||||||||||||||||||
| 565 | 'EXCEPTION' => [ 'exception', '2.0' ], | ||||||||||||||||||||||||||||
| 566 | 'FACTORY' => [ 'factory', '2.3' ], | ||||||||||||||||||||||||||||
| 567 | 'FALSE' => [ 'FALSE', '2.0' ], | ||||||||||||||||||||||||||||
| 568 | 'FINDER' => [ 'finder', '3.0' ], | ||||||||||||||||||||||||||||
| 569 | 'FIXED' => [ 'fixed', '2.1' ], | ||||||||||||||||||||||||||||
| 570 | 'FLOAT' => [ 'float', '2.0' ], | ||||||||||||||||||||||||||||
| 571 | 'GETRAISES' => [ 'getraises', '3.0' ], | ||||||||||||||||||||||||||||
| 572 | 'HOME' => [ 'home', '3.0' ], | ||||||||||||||||||||||||||||
| 573 | 'IMPORT' => [ 'import', '3.0' ], | ||||||||||||||||||||||||||||
| 574 | 'IN' => [ 'in', '2.0' ], | ||||||||||||||||||||||||||||
| 575 | 'INOUT' => [ 'inout', '2.0' ], | ||||||||||||||||||||||||||||
| 576 | 'INTERFACE' => [ 'interface', '2.0' ], | ||||||||||||||||||||||||||||
| 577 | 'LOCAL' => [ 'local', '2.4' ], | ||||||||||||||||||||||||||||
| 578 | 'LONG' => [ 'long', '2.0' ], | ||||||||||||||||||||||||||||
| 579 | 'MODULE' => [ 'module', '2.0' ], | ||||||||||||||||||||||||||||
| 580 | 'MULTIPLE' => [ 'multiple', '3.0' ], | ||||||||||||||||||||||||||||
| 581 | 'NATIVE' => [ 'native', '2.2' ], | ||||||||||||||||||||||||||||
| 582 | 'OBJECT' => [ 'Object', '2.0' ], | ||||||||||||||||||||||||||||
| 583 | 'OCTET' => [ 'octet', '2.0' ], | ||||||||||||||||||||||||||||
| 584 | 'ONEWAY' => [ 'oneway', '2.0' ], | ||||||||||||||||||||||||||||
| 585 | 'OUT' => [ 'out', '2.0' ], | ||||||||||||||||||||||||||||
| 586 | 'PRIMARYKEY' => [ 'primarykey', '3.0' ], | ||||||||||||||||||||||||||||
| 587 | 'PRIVATE' => [ 'private', '2.3' ], | ||||||||||||||||||||||||||||
| 588 | 'PROVIDES' => [ 'provides', '3.0' ], | ||||||||||||||||||||||||||||
| 589 | 'PUBLIC' => [ 'public', '2.3' ], | ||||||||||||||||||||||||||||
| 590 | 'PUBLISHES' => [ 'publishes', '3.0' ], | ||||||||||||||||||||||||||||
| 591 | 'RAISES' => [ 'raises', '2.0' ], | ||||||||||||||||||||||||||||
| 592 | 'READONLY' => [ 'readonly', '2.0' ], | ||||||||||||||||||||||||||||
| 593 | 'SEQUENCE' => [ 'sequence', '2.0' ], | ||||||||||||||||||||||||||||
| 594 | 'SETRAISES' => [ 'setraises', '3.0' ], | ||||||||||||||||||||||||||||
| 595 | 'SHORT' => [ 'short', '2.0' ], | ||||||||||||||||||||||||||||
| 596 | 'STRING' => [ 'string', '2.0' ], | ||||||||||||||||||||||||||||
| 597 | 'STRUCT' => [ 'struct', '2.0' ], | ||||||||||||||||||||||||||||
| 598 | 'SUPPORTS' => [ 'supports', '2.3' ], | ||||||||||||||||||||||||||||
| 599 | 'SWITCH' => [ 'switch', '2.0' ], | ||||||||||||||||||||||||||||
| 600 | 'TRUE' => [ 'TRUE', '2.0' ], | ||||||||||||||||||||||||||||
| 601 | 'TRUNCATABLE' => [ 'truncatable', '2.3' ], | ||||||||||||||||||||||||||||
| 602 | 'TYPEDEF' => [ 'typedef', '2.0' ], | ||||||||||||||||||||||||||||
| 603 | 'TYPEID' => [ 'typeid', '3.0' ], | ||||||||||||||||||||||||||||
| 604 | 'TYPEPREFIX' => [ 'typeprefix', '3.0' ], | ||||||||||||||||||||||||||||
| 605 | 'UNION' => [ 'union', '2.0' ], | ||||||||||||||||||||||||||||
| 606 | 'UNSIGNED' => [ 'unsigned', '2.0' ], | ||||||||||||||||||||||||||||
| 607 | 'USES' => [ 'uses', '3.0' ], | ||||||||||||||||||||||||||||
| 608 | 'VALUEBASE' => [ 'ValueBase', '2.3' ], | ||||||||||||||||||||||||||||
| 609 | 'VALUETYPE' => [ 'valuetype', '2.3' ], | ||||||||||||||||||||||||||||
| 610 | 'VOID' => [ 'void', '2.0' ], | ||||||||||||||||||||||||||||
| 611 | 'WCHAR' => [ 'wchar', '2.1' ], | ||||||||||||||||||||||||||||
| 612 | 'WSTRING' => [ 'wstring', '2.1' ] | ||||||||||||||||||||||||||||
| 613 | ); | ||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||
| 615 | 0 | $parser->YYData->{keyword} = \%keywords; | |||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | 1 | 1; | |||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||