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 | |
973c2be1 |
6 | This library is free software; you can redistribute it and / or modify it |
7 | under the terms of the GNU Lesser General Public version 2.1 as published |
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 | |
105aae76 |
43 | // disable MSVC warnings in flex code |
44 | #ifdef _MSC_VER |
45 | #pragma warning(disable:4131 4244 4273 4267 4127) |
46 | #endif |
47 | |
566f8441 |
48 | // disable GCC warnings in flex code |
49 | #ifdef __GNUC__ |
50 | #pragma GCC diagnostic ignored "-Wunused-function" |
51 | #endif |
52 | |
7fd59977 |
53 | %} |
54 | %% |
55 | " " {;} |
56 | " " {;} |
57 | [\n] { steplineno ++; } |
58 | [\r] {;} /* abv 30.06.00: for reading DOS files */ |
59 | [\0]+ {;} /* fix from C21. for test load e3i file with line 15 with null symbols */ |
60 | |
61 | #[0-9]+/= { resultat(); if (modcom == 0) return(ENTITY); } |
62 | #[0-9]+/[ ]*= { resultat(); if (modcom == 0) return(ENTITY); } |
63 | #[0-9]+ { resultat(); if (modcom == 0) return(IDENT); } |
64 | [-+0-9][0-9]* { resultat(); if (modcom == 0) { rec_typarg(rec_argInteger); return(QUID); } } |
65 | [-+\.0-9][\.0-9]+ { resultat(); if (modcom == 0) { rec_typarg(rec_argFloat); return(QUID); } } |
66 | [-+\.0-9][\.0-9]+E[-+0-9][0-9]* { resultat(); if (modcom == 0) { rec_typarg(rec_argFloat); return(QUID); } } |
67 | [\']([\n]|[\000\011-\046\050-\176\201-\237\240-\777]|[\047][\047])*[\'] { resultat(); if (modcom == 0) { rec_typarg(rec_argText); return(QUID); } } |
68 | ["][0-9A-F]+["] { resultat(); if (modcom == 0) { rec_typarg(rec_argHexa); return(QUID); } } |
69 | [.][A-Z0-9_]+[.] { resultat(); if (modcom == 0) { rec_typarg(rec_argEnum); return(QUID); } } |
70 | [(] { if (modcom == 0) return ('('); } |
71 | [)] { if (modcom == 0) return (')'); } |
72 | [,] { if (modcom == 0) return (','); } |
73 | [$] { resultat(); if (modcom == 0) { rec_typarg(rec_argNondef); return(QUID); } } |
74 | [=] { if (modcom == 0) return ('='); } |
75 | [;] { if (modcom == 0) return (';'); } |
76 | "/*" { modcom = 1; } |
77 | "*/" { if (modend == 0) modcom = 0; } |
78 | |
79 | STEP; { if (modcom == 0) return(STEP); } |
80 | HEADER; { if (modcom == 0) return(HEADER); } |
81 | ENDSEC; { if (modcom == 0) return(ENDSEC); } |
82 | DATA; { if (modcom == 0) return(DATA); } |
83 | ENDSTEP; { if (modend == 0) {modcom = 0; return(ENDSTEP);} } |
84 | "ENDSTEP;".* { if (modend == 0) {modcom = 0; return(ENDSTEP);} } |
85 | END-ISO[0-9\-]*; { modcom = 1; modend = 1; return(ENDSTEP); } |
86 | ISO[0-9\-]*; { if (modend == 0) {modcom = 0; return(STEP); } } |
87 | |
88 | [/] { if (modcom == 0) return ('/'); } |
89 | &SCOPE { if (modcom == 0) return(SCOPE); } |
90 | ENDSCOPE { if (modcom == 0) return(ENDSCOPE); } |
91 | [a-zA-Z0-9_]+ { resultat(); if (modcom == 0) return(TYPE); } |
92 | ![a-zA-Z0-9_]+ { resultat(); if (modcom == 0) return(TYPE); } |
93 | [^)] { resultat(); if (modcom == 0) { rec_typarg(rec_argMisc); return(QUID); } } |