b311480e |
1 | /* |
973c2be1 |
2 | Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | |
973c2be1 |
4 | This file is part of Open CASCADE Technology software library. |
b311480e |
5 | |
d5f74e42 |
6 | This library is free software; you can redistribute it and/or modify it under |
7 | the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | by the Free Software Foundation, with special exception defined in the file |
9 | OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | |
973c2be1 |
12 | Alternatively, this file may be used under the terms of Open CASCADE |
13 | commercial license or contractual agreement. |
b311480e |
14 | */ |
15 | |
7fd59977 |
16 | %{ |
17 | #include "step.tab.h" |
18 | #include "recfile.ph" |
19 | #include "stdio.h" |
20 | #include <StepFile_CallFailure.hxx> |
21 | |
22 | /* skl 31.01.2002 for OCC133(OCC96,97) - uncorrect |
23 | long string in files Henri.stp and 401.stp*/ |
24 | #define YY_FATAL_ERROR(msg) StepFile_CallFailure( msg ) |
25 | |
26 | /* abv 07.06.02: force inclusion of stdlib.h on WNT to avoid warnings */ |
27 | #include <stdlib.h> |
28 | |
29 | /* |
30 | void steperror ( FILE *input_file ); |
31 | void steprestart ( FILE *input_file ); |
32 | */ |
33 | void rec_restext(char *newtext, int lentext); |
34 | void rec_typarg(int argtype); |
35 | |
36 | int steplineno; /* Comptage de ligne (ben oui, fait tout faire) */ |
37 | |
38 | int modcom = 0; /* Commentaires type C */ |
39 | int modend = 0; /* Flag for finishing of the STEP file */ |
40 | void resultat () /* Resultat alloue dynamiquement, "jete" une fois lu */ |
41 | { if (modcom == 0) rec_restext(yytext,yyleng); } |
42 | |
f58f9b92 |
43 | // MSVC specifics |
105aae76 |
44 | #ifdef _MSC_VER |
f58f9b92 |
45 | |
46 | // disable MSVC warnings in flex code |
2a54ebbf |
47 | // Note that Intel compiler also defines _MSC_VER but has different warning ids |
48 | #if defined(__INTEL_COMPILER) |
49 | #pragma warning(disable:177 1786 1736) |
50 | #else |
105aae76 |
51 | #pragma warning(disable:4131 4244 4273 4267 4127) |
2a54ebbf |
52 | #endif |
f58f9b92 |
53 | |
54 | // Avoid includion of unistd.h if parser is generated on Linux (flex 2.5.35) |
55 | #define YY_NO_UNISTD_H |
56 | |
105aae76 |
57 | #endif |
58 | |
566f8441 |
59 | // disable GCC warnings in flex code |
60 | #ifdef __GNUC__ |
61 | #pragma GCC diagnostic ignored "-Wunused-function" |
62 | #endif |
63 | |
7fd59977 |
64 | %} |
65 | %% |
66 | " " {;} |
67 | " " {;} |
68 | [\n] { steplineno ++; } |
69 | [\r] {;} /* abv 30.06.00: for reading DOS files */ |
70 | [\0]+ {;} /* fix from C21. for test load e3i file with line 15 with null symbols */ |
71 | |
72 | #[0-9]+/= { resultat(); if (modcom == 0) return(ENTITY); } |
73 | #[0-9]+/[ ]*= { resultat(); if (modcom == 0) return(ENTITY); } |
74 | #[0-9]+ { resultat(); if (modcom == 0) return(IDENT); } |
75 | [-+0-9][0-9]* { resultat(); if (modcom == 0) { rec_typarg(rec_argInteger); return(QUID); } } |
76 | [-+\.0-9][\.0-9]+ { resultat(); if (modcom == 0) { rec_typarg(rec_argFloat); return(QUID); } } |
77 | [-+\.0-9][\.0-9]+E[-+0-9][0-9]* { resultat(); if (modcom == 0) { rec_typarg(rec_argFloat); return(QUID); } } |
78 | [\']([\n]|[\000\011-\046\050-\176\201-\237\240-\777]|[\047][\047])*[\'] { resultat(); if (modcom == 0) { rec_typarg(rec_argText); return(QUID); } } |
79 | ["][0-9A-F]+["] { resultat(); if (modcom == 0) { rec_typarg(rec_argHexa); return(QUID); } } |
80 | [.][A-Z0-9_]+[.] { resultat(); if (modcom == 0) { rec_typarg(rec_argEnum); return(QUID); } } |
81 | [(] { if (modcom == 0) return ('('); } |
82 | [)] { if (modcom == 0) return (')'); } |
83 | [,] { if (modcom == 0) return (','); } |
84 | [$] { resultat(); if (modcom == 0) { rec_typarg(rec_argNondef); return(QUID); } } |
85 | [=] { if (modcom == 0) return ('='); } |
86 | [;] { if (modcom == 0) return (';'); } |
87 | "/*" { modcom = 1; } |
88 | "*/" { if (modend == 0) modcom = 0; } |
89 | |
90 | STEP; { if (modcom == 0) return(STEP); } |
91 | HEADER; { if (modcom == 0) return(HEADER); } |
92 | ENDSEC; { if (modcom == 0) return(ENDSEC); } |
93 | DATA; { if (modcom == 0) return(DATA); } |
94 | ENDSTEP; { if (modend == 0) {modcom = 0; return(ENDSTEP);} } |
95 | "ENDSTEP;".* { if (modend == 0) {modcom = 0; return(ENDSTEP);} } |
96 | END-ISO[0-9\-]*; { modcom = 1; modend = 1; return(ENDSTEP); } |
97 | ISO[0-9\-]*; { if (modend == 0) {modcom = 0; return(STEP); } } |
98 | |
99 | [/] { if (modcom == 0) return ('/'); } |
100 | &SCOPE { if (modcom == 0) return(SCOPE); } |
101 | ENDSCOPE { if (modcom == 0) return(ENDSCOPE); } |
102 | [a-zA-Z0-9_]+ { resultat(); if (modcom == 0) return(TYPE); } |
103 | ![a-zA-Z0-9_]+ { resultat(); if (modcom == 0) return(TYPE); } |
104 | [^)] { resultat(); if (modcom == 0) { rec_typarg(rec_argMisc); return(QUID); } } |