1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0031000: Data Exchange - STEP file cannot be opened due to lower-case special token End-ISO-10303-21

Update flex lexical scanner (step.lex lex.step.cxx) to parse special tokens in a case insensitive manner
This commit is contained in:
dpasukhi 2020-11-24 15:52:39 +03:00 committed by bugmaster
parent a25d5aaa30
commit 465ffe2840
3 changed files with 151 additions and 109 deletions

View File

@ -1,4 +1,3 @@
#line 30 "D:/ABV/OCCT/occt/src/StepFile/step.lex"
// This file is part of Open CASCADE Technology software library. // This file is part of Open CASCADE Technology software library.
// This file is generated, do not modify it directly; edit source file step.lex instead. // This file is generated, do not modify it directly; edit source file step.lex instead.
@ -496,11 +495,11 @@ static const YY_CHAR yy_ec[256] =
22, 1, 1, 1, 23, 24, 25, 26, 27, 24, 22, 1, 1, 1, 23, 24, 25, 26, 27, 24,
28, 29, 30, 28, 28, 28, 28, 31, 32, 33, 28, 29, 30, 28, 28, 28, 28, 31, 32, 33,
28, 34, 35, 36, 28, 28, 28, 28, 28, 28, 28, 34, 35, 36, 28, 28, 28, 28, 28, 28,
1, 1, 1, 1, 28, 1, 37, 37, 37, 37, 1, 1, 1, 1, 28, 1, 37, 38, 39, 40,
37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 41, 38, 38, 42, 43, 38, 38, 38, 38, 44,
37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 45, 46, 38, 47, 48, 49, 38, 38, 38, 38,
37, 37, 1, 1, 1, 1, 1, 1, 1, 1, 38, 38, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -517,126 +516,141 @@ static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1 1, 1, 1, 1, 1
} ; } ;
static const YY_CHAR yy_meta[39] = static const YY_CHAR yy_meta[51] =
{ 0, { 0,
1, 1, 2, 3, 3, 1, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
4, 1, 3, 5, 1, 3, 1, 6, 1, 7, 3, 1, 1, 4, 1, 1, 1, 5, 1, 6,
1, 1, 7, 7, 7, 7, 7, 8, 8, 8, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6,
8, 8, 8, 8, 8, 8, 9, 1 6, 6, 6, 6, 6, 6, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 1
} ; } ;
static const flex_int16_t yy_base[135] = static const flex_int16_t yy_base[133] =
{ 0, { 0,
0, 0, 36, 37, 264, 263, 38, 41, 265, 268, 0, 0, 48, 49, 256, 255, 50, 53, 257, 327,
268, 268, 268, 268, 0, 0, 244, 268, 228, 268, 327, 327, 327, 327, 0, 45, 225, 327, 19, 327,
268, 268, 25, 268, 28, 248, 35, 268, 268, 243, 327, 327, 37, 327, 40, 228, 55, 327, 327, 223,
24, 36, 38, 39, 40, 222, 0, 268, 45, 268, 56, 58, 59, 48, 62, 154, 0, 327, 68, 327,
0, 268, 47, 0, 252, 64, 233, 50, 53, 61, 0, 327, 100, 0, 94, 86, 53, 104, 105, 108,
239, 268, 65, 238, 54, 69, 71, 43, 64, 217, 181, 327, 109, 122, 63, 112, 72, 115, 116, 89,
0, 79, 82, 268, 0, 84, 268, 268, 97, 268, 0, 96, 123, 327, 0, 146, 327, 327, 139, 327,
222, 88, 86, 92, 268, 100, 93, 104, 105, 107, 52, 148, 128, 149, 327, 155, 153, 160, 156, 163,
96, 268, 213, 217, 112, 115, 116, 205, 118, 120, 161, 327, 112, 74, 136, 167, 168, 158, 173, 175,
129, 0, 268, 123, 199, 200, 122, 133, 268, 182, 198, 203, 327, 185, 170, 65, 207, 208, 327, 157,
130, 134, 137, 44, 268, 268, 144, 138, 139, 140, 199, 211, 212, 214, 327, 327, 201, 216, 192, 219,
145, 148, 143, 268, 154, 268, 157, 268, 149, 0, 217, 234, 229, 327, 222, 327, 243, 327, 41, 0,
0, 268, 178, 187, 196, 199, 119, 203, 206, 215, 0, 327, 270, 277, 284, 286, 289, 291, 298, 305,
224, 233, 241, 244 312, 319
} ; } ;
static const flex_int16_t yy_def[135] = static const flex_int16_t yy_def[133] =
{ 0, { 0,
122, 1, 123, 123, 124, 124, 125, 125, 122, 122, 122, 1, 123, 123, 124, 124, 125, 125, 122, 122,
122, 122, 122, 122, 126, 127, 122, 122, 122, 122, 122, 122, 122, 122, 126, 122, 122, 122, 122, 122,
122, 122, 122, 122, 128, 122, 129, 122, 122, 129, 122, 122, 122, 122, 127, 122, 128, 122, 122, 128,
129, 129, 129, 129, 129, 122, 130, 122, 131, 122, 128, 128, 128, 128, 128, 122, 129, 122, 130, 122,
132, 122, 133, 126, 127, 122, 122, 122, 122, 128, 131, 122, 122, 126, 122, 122, 122, 122, 122, 127,
128, 122, 129, 129, 129, 129, 129, 129, 129, 122, 127, 122, 128, 128, 128, 128, 128, 128, 128, 122,
130, 131, 131, 122, 132, 133, 122, 122, 122, 122, 129, 130, 130, 122, 131, 122, 122, 122, 122, 122,
122, 122, 122, 128, 122, 129, 129, 129, 129, 129, 122, 122, 122, 127, 122, 128, 128, 128, 128, 128,
129, 122, 122, 122, 128, 129, 129, 122, 129, 129, 128, 122, 122, 122, 127, 128, 128, 122, 128, 128,
122, 80, 122, 129, 122, 122, 128, 129, 122, 122, 122, 128, 122, 128, 122, 122, 127, 128, 122, 122,
129, 129, 129, 129, 122, 122, 122, 129, 129, 129, 128, 128, 128, 128, 122, 122, 122, 128, 128, 128,
129, 122, 129, 122, 129, 122, 122, 122, 129, 134, 128, 122, 128, 122, 128, 122, 122, 122, 128, 132,
134, 0, 122, 122, 122, 122, 122, 122, 122, 122, 132, 0, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122 122, 122
} ; } ;
static const flex_int16_t yy_nxt[307] = static const flex_int16_t yy_nxt[378] =
{ 0, { 0,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 10, 23, 24, 23, 25, 26, 27, 20, 21, 22, 10, 23, 24, 23, 25, 26, 27,
28, 29, 30, 30, 30, 31, 32, 30, 33, 34, 28, 29, 30, 30, 30, 31, 32, 30, 33, 34,
30, 30, 30, 30, 35, 30, 30, 36, 38, 38, 30, 30, 30, 30, 35, 30, 30, 30, 30, 31,
42, 122, 48, 42, 49, 48, 55, 50, 43, 39, 32, 33, 34, 30, 30, 30, 30, 35, 30, 36,
39, 43, 48, 122, 53, 122, 122, 122, 63, 67, 38, 38, 42, 47, 48, 42, 49, 48, 122, 50,
122, 122, 67, 64, 57, 69, 56, 48, 69, 48, 43, 39, 39, 43, 45, 122, 47, 45, 45, 45,
48, 122, 49, 58, 80, 59, 72, 111, 73, 72, 45, 45, 48, 122, 53, 122, 122, 71, 55, 122,
50, 122, 48, 46, 53, 70, 122, 74, 122, 77, 122, 63, 58, 83, 96, 57, 64, 69, 56, 122,
81, 76, 122, 79, 78, 63, 67, 122, 69, 67, 69, 71, 55, 96, 79, 58, 83, 59, 77, 57,
64, 69, 84, 48, 84, 48, 84, 84, 84, 75, 68, 56, 66, 66, 66, 46, 66, 70, 79, 122,
122, 85, 72, 122, 84, 87, 84, 122, 82, 86, 59, 77, 67, 45, 122, 67, 45, 45, 45, 45,
88, 122, 122, 91, 122, 45, 92, 93, 94, 75, 45, 48, 48, 48, 49, 73, 48, 50, 53, 122,
90, 97, 122, 122, 98, 122, 99, 122, 89, 75, 72, 72, 122, 122, 74, 76, 63, 78, 60, 122,
122, 97, 101, 105, 102, 91, 104, 122, 91, 93, 69, 64, 81, 69, 95, 48, 80, 48, 66, 66,
122, 122, 98, 103, 122, 122, 122, 122, 109, 114, 66, 78, 66, 75, 72, 97, 81, 95, 67, 80,
122, 108, 122, 110, 117, 116, 122, 117, 118, 119, 82, 67, 84, 84, 84, 84, 75, 84, 85, 84,
113, 122, 115, 117, 120, 112, 117, 118, 37, 37, 122, 84, 122, 122, 86, 87, 88, 122, 122, 91,
122, 90, 92, 93, 122, 122, 98, 100, 99, 87,
122, 107, 122, 94, 89, 90, 106, 101, 75, 102,
100, 104, 122, 60, 107, 105, 94, 89, 103, 122,
106, 101, 114, 102, 91, 104, 122, 91, 93, 91,
122, 103, 92, 93, 75, 122, 97, 98, 122, 122,
108, 122, 112, 122, 122, 109, 122, 116, 110, 122,
122, 52, 120, 108, 46, 112, 122, 111, 113, 109,
117, 115, 110, 117, 118, 119, 122, 38, 38, 117,
111, 113, 117, 118, 115, 122, 122, 122, 122, 119,
37, 37, 37, 37, 37, 37, 37, 40, 40, 40, 37, 37, 37, 37, 37, 37, 37, 40, 40, 40,
40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41,
41, 44, 44, 51, 51, 54, 54, 54, 61, 122,
41, 41, 41, 41, 41, 44, 44, 44, 51, 51, 61, 122, 61, 61, 61, 62, 122, 62, 62, 62,
51, 54, 54, 54, 54, 61, 107, 61, 61, 96, 62, 62, 65, 122, 122, 65, 65, 65, 65, 121,
61, 61, 61, 61, 62, 106, 62, 62, 62, 62, 122, 121, 121, 121, 121, 121, 9, 122, 122, 122,
62, 62, 62, 65, 100, 65, 96, 65, 65, 65,
65, 65, 66, 66, 121, 95, 121, 121, 121, 121,
121, 121, 121, 83, 60, 122, 75, 71, 68, 60,
122, 52, 47, 46, 122, 38, 38, 9, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122 122, 122, 122, 122, 122, 122, 122
} ; } ;
static const flex_int16_t yy_chk[307] = static const flex_int16_t yy_chk[378] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7, 31, 23, 8, 23, 25, 31, 25, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4, 8, 27, 32, 27, 33, 34, 35, 39, 43, 3, 4, 7, 19, 23, 8, 23, 25, 119, 25,
58, 104, 43, 39, 33, 46, 32, 48, 46, 48, 7, 3, 4, 8, 16, 34, 19, 16, 16, 16,
49, 55, 49, 34, 58, 35, 48, 104, 50, 49, 16, 16, 27, 31, 27, 32, 33, 47, 31, 35,
50, 59, 53, 46, 53, 46, 56, 50, 57, 55, 55, 39, 34, 71, 96, 33, 39, 46, 32, 57,
59, 53, 62, 57, 56, 63, 66, 62, 69, 66, 46, 47, 31, 84, 57, 34, 71, 35, 55, 33,
63, 69, 72, 73, 72, 73, 74, 72, 74, 74, 45, 32, 43, 43, 43, 46, 43, 46, 57, 62,
77, 74, 73, 81, 76, 77, 76, 76, 69, 76, 35, 55, 43, 45, 62, 43, 45, 45, 45, 45,
78, 78, 79, 80, 80, 127, 80, 80, 81, 85, 45, 48, 49, 48, 49, 50, 53, 50, 53, 56,
79, 85, 86, 87, 86, 89, 87, 90, 78, 97, 48, 49, 58, 59, 50, 53, 63, 56, 60, 54,
94, 97, 89, 94, 89, 91, 90, 101, 91, 91, 69, 63, 59, 69, 83, 73, 58, 73, 66, 66,
98, 102, 98, 89, 103, 108, 109, 110, 102, 109, 66, 56, 66, 85, 73, 85, 59, 83, 66, 58,
113, 101, 111, 103, 112, 111, 119, 112, 112, 113, 69, 66, 72, 74, 72, 74, 74, 72, 74, 76,
108, 115, 110, 117, 115, 107, 117, 117, 123, 123, 77, 76, 76, 79, 76, 77, 78, 78, 81, 80,
80, 79, 80, 80, 86, 87, 86, 88, 87, 77,
89, 100, 90, 81, 78, 79, 95, 89, 51, 89,
88, 90, 94, 36, 100, 94, 81, 78, 89, 109,
95, 89, 109, 89, 91, 90, 101, 91, 91, 92,
92, 89, 92, 92, 97, 98, 97, 98, 102, 103,
101, 104, 107, 108, 111, 102, 110, 111, 103, 115,
30, 26, 115, 101, 17, 107, 113, 104, 108, 102,
112, 110, 103, 112, 112, 113, 9, 6, 5, 117,
104, 108, 117, 117, 110, 0, 0, 0, 0, 113,
123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124,
124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125,
125, 126, 126, 127, 127, 128, 128, 128, 129, 0,
125, 125, 125, 125, 125, 126, 126, 126, 128, 128, 129, 0, 129, 129, 129, 130, 0, 130, 130, 130,
128, 129, 129, 129, 129, 130, 100, 130, 130, 96, 130, 130, 131, 0, 0, 131, 131, 131, 131, 132,
130, 130, 130, 130, 131, 95, 131, 131, 131, 131, 0, 132, 132, 132, 132, 132, 122, 122, 122, 122,
131, 131, 131, 132, 88, 132, 84, 132, 132, 132,
132, 132, 133, 133, 134, 83, 134, 134, 134, 134,
134, 134, 134, 71, 60, 54, 51, 47, 45, 36,
30, 26, 19, 17, 9, 6, 5, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122 122, 122, 122, 122, 122, 122, 122
} ; } ;
@ -952,7 +966,7 @@ yy_match:
*(yy_state_ptr)++ = yy_current_state; *(yy_state_ptr)++ = yy_current_state;
++yy_cp; ++yy_cp;
} }
while ( yy_base[yy_current_state] != 268 ); while ( yy_base[yy_current_state] != 327 );
yy_find_action: yy_find_action:
yy_current_state = *--(yy_state_ptr); yy_current_state = *--(yy_state_ptr);
@ -1579,7 +1593,7 @@ int yyFlexLexer::yy_get_next_buffer()
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{ {
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 38); YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 50);
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
@ -1603,7 +1617,7 @@ int yyFlexLexer::yy_get_next_buffer()
{ {
int yy_is_jam; int yy_is_jam;
YY_CHAR yy_c = 38; YY_CHAR yy_c = 50;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];

View File

@ -121,23 +121,23 @@ void rec_typarg(int argtype);
[=] { return ('='); } [=] { return ('='); }
[;] { return (';'); } [;] { return (';'); }
STEP; { return(token::STEP); } (?i:STEP); { return(token::STEP); }
HEADER; { return(token::HEADER); } (?i:HEADER); { return(token::HEADER); }
ENDSEC; { return(token::ENDSEC); } (?i:ENDSEC); { return(token::ENDSEC); }
DATA; { return(token::DATA); } (?i:DATA); { return(token::DATA); }
ENDSTEP; { return(token::ENDSTEP);} (?i:ENDSTEP); { return(token::ENDSTEP);}
"ENDSTEP;".* { return(token::ENDSTEP);} (?i:ENDSTEP);.* { return(token::ENDSTEP);}
END-ISO[0-9\-]*; { BEGIN(End); return(token::ENDSTEP); } /* at the end of the STEP data, enter dedicated start condition "End" to skip everything that follows */ (?i:END-ISO)[0-9\-]*; { BEGIN(End); return(token::ENDSTEP); } /* at the end of the STEP data, enter dedicated start condition "End" to skip everything that follows */
ISO[0-9\-]*; { return(token::STEP); } (?i:ISO)[0-9\-]*; { return(token::STEP); }
[/] { return ('/'); } [/] { return ('/'); }
&SCOPE { return(token::SCOPE); } &(?i:SCOPE) { return(token::SCOPE); }
ENDSCOPE { return(token::ENDSCOPE); } (?i:ENDSCOPE) { return(token::ENDSCOPE); }
[a-zA-Z0-9_]+ { rec_restext(YYText(),YYLeng()); return(token::TYPE); } [a-zA-Z0-9_]+ { rec_restext(YYText(),YYLeng()); return(token::TYPE); }
![a-zA-Z0-9_]+ { rec_restext(YYText(),YYLeng()); return(token::TYPE); } ![a-zA-Z0-9_]+ { rec_restext(YYText(),YYLeng()); return(token::TYPE); }
[^)] { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argMisc); return(token::QUID); } [^)] { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argMisc); return(token::QUID); }
<End>[^\n] {;} /* skip any characters (except newlines) */ <End>[^\n] {;} /* skip any characters (except newlines) */
%% %%

28
tests/bugs/step/bug31000 Normal file
View File

@ -0,0 +1,28 @@
puts "# ====================================================================="
puts "# 0031000: Data Exchange - STEP file cannot be opened due to lower-case special token End-ISO-10303-21"
puts "# ====================================================================="
puts ""
pload OCAF
catch { Close D }
# Read file
ReadStep D [locate_data_file bug31000_InSensitive.stp]
# Checking
set state [data c]
if { [regexp "361 Entities, of which 4 Root" $state] != 1 } {
puts "Error : wrong count of transferred roots"
}
set xst [ XStat D 1]
if { [regexp "Number of labels with color link = 1" $xst] != 1} {
puts "Error : wrong count of color link"
}
if { [regexp {0:1:1:1 SOLID has attributes: Color([(])RED 1([)])} $xst] != 1} {
puts "Error : wrong shape 0:1:1:1"
}
XGetOneShape res D
checknbshapes res -face 6 -shell 1 -solid 1
checkshape res f