00001
00002
00003 %%
00004
00005 "/*" {
00006 int c1 = 0, c2 = input();
00007 for ( ; ; )
00008 {
00009 if (c2 == EOF)
00010 break;
00011 if (c1 == '*' && c2 == '/')
00012 break;
00013 c1 = c2; c2 = input();
00014 }
00015 };
00016
00017 ^[\t ]*"//BTX".*$ {
00018 int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = input();
00019 for ( ; ; )
00020 {
00021 if (c5 == EOF)
00022 break;
00023 if (c1 == '/' && c2 == '/' && c3 == 'E' && c4 == 'T' && c5 == 'X')
00024 break;
00025 c1 = c2;
00026 c2 = c3;
00027 c3 = c4;
00028 c4 = c5;
00029 c5 = input();
00030 }
00031 for ( ; ; )
00032 {
00033 if (c5 == EOF)
00034 break;
00035 if (c5 == '\n')
00036 break;
00037 c5 = input();
00038 }
00039 };
00040
00041 ^[\t ]*"// .NAME".* {
00042 int pos = 1;
00043 while (yytext[pos-1] != 'M' || yytext[pos] != 'E')
00044 pos++;
00045 yylval.str = (char *)malloc(yyleng + 1 - pos - 1);
00046 memcpy(yylval.str,yytext+ pos + 1,yyleng - pos - 1);
00047 yylval.str[yyleng - pos - 1] = '\0';
00048 data.NameComment = strdup(yylval.str);
00049 }
00050
00051 ^[\t ]*"// .SECTION Description".* {
00052 CommentState = 1;
00053 data.Description = (char*)malloc(100000);
00054 data.Description[0] = '\0';
00055 };
00056
00057 ^[\t ]*"// .SECTION See Also".* {
00058 CommentState = 3;
00059 data.SeeAlso = (char*)malloc(100000);
00060 data.SeeAlso[0] = '\0';
00061 };
00062
00063 ^[\t ]*"// .SECTION see also".* {
00064 CommentState = 3;
00065 data.SeeAlso = (char*)malloc(100000);
00066 data.SeeAlso[0] = '\0';
00067 };
00068
00069 ^[\t ]*"// .SECTION Caveats".* {
00070 CommentState = 4;
00071 data.Caveats = (char*)malloc(100000);
00072 data.Caveats[0] = '\0';
00073 };
00074
00075 ^[\t ]*"// Description:".* {
00076 CommentState = 2;
00077 HaveComment = 1;
00078 CommentText[0] = '\0';
00079 };
00080
00081 ^[\t ]*[\n] {
00082 HaveComment = 0;
00083 CommentState = 0;
00084 };
00085
00086 ^[\t ]*"//".* {
00087 int pos = 1;
00088 while (yytext[pos-1] != '/' || yytext[pos] != '/')
00089 pos++;
00090 yylval.str = (char *)malloc(yyleng + 1 - pos - 1 + 1);
00091 memcpy(yylval.str,yytext+ pos + 1,yyleng - pos - 1);
00092 yylval.str[yyleng - pos - 1] = '\n';
00093 yylval.str[yyleng - pos] = '\0';
00094 switch (CommentState)
00095 {
00096 case 1:
00097 strcat(data.Description,yylval.str);
00098 break;
00099 case 2:
00100 strcat(CommentText,yylval.str);
00101 break;
00102 case 3:
00103 strcat(data.SeeAlso,yylval.str);
00104 break;
00105 case 4:
00106 strcat(data.Caveats,yylval.str);
00107 break;
00108 }
00109 };
00110
00111 "//".* ;
00112
00113 "VTK_EXPORT" ;
00114
00115 "vtkNotUsed"[ ]*"("[^)]*")" ;
00116
00117 "["[\t\n\ ]*[1-9][0-9]*[\t\n ]*"]" {
00118 sscanf(yytext+1,"%d",&yylval.integer);
00119 return (ARRAY_NUM);
00120 };
00121
00122
00123 "class "[\t\n ]*"vtk"[a-zA-Z0-9_]*[\t\n ]*";" return(CLASS_REF);
00124
00125 "void"[\t\n ]*"("[\t\n ]*"*"[a-zA-Z0-9_]*[\t\n ]*")"[\t\n ]*"("[\t\n ]*"void"[\t\n ]*"*"[\n\t ]*")" return(VAR_FUNCTION);
00126
00127 "short"[\t\n ]*"int" return(SHORT);
00128 "long"[\t\n ]*"int" return(LONG);
00129 "int"[\t\n ]*"short" return(SHORT);
00130 "int"[\t\n ]*"long" return(LONG);
00131
00132 "class" return(CLASS);
00133 "public" return(PUBLIC);
00134 "private" return(PRIVATE);
00135 "protected" return(PROTECTED);
00136 "int" return(INT);
00137 "float" return(FLOAT);
00138 "short" return(SHORT);
00139 "long" return(LONG);
00140 "double" return(DOUBLE);
00141 "void" return(VOID);
00142 "char" return(CHAR);
00143 "virtual" return(VIRTUAL);
00144 "const" return(CONST);
00145 "operator" return(OPERATOR);
00146 "unsigned" return(UNSIGNED);
00147 "friend" return(FRIEND);
00148 "static" return(STATIC);
00149
00150 "vtkSetMacro" return(SetMacro);
00151 "vtkGetMacro" return(GetMacro);
00152 "vtkSetStringMacro" return(SetStringMacro);
00153 "vtkGetStringMacro" return(GetStringMacro);
00154 "vtkSetClampMacro" return(SetClampMacro);
00155 "vtkSetObjectMacro" return(SetObjectMacro);
00156 "vtkSetReferenceCountedObjectMacro" return(SetReferenceCountedObjectMacro);
00157 "vtkGetObjectMacro" return(GetObjectMacro);
00158 "vtkBooleanMacro" return(BooleanMacro);
00159 "vtkSetVector2Macro" return(SetVector2Macro);
00160 "vtkSetVector3Macro" return(SetVector3Macro);
00161 "vtkSetVector4Macro" return(SetVector4Macro);
00162 "vtkSetVector6Macro" return(SetVector6Macro);
00163 "vtkGetVector2Macro" return(GetVector2Macro);
00164 "vtkGetVector3Macro" return(GetVector3Macro);
00165 "vtkGetVector4Macro" return(GetVector4Macro);
00166 "vtkGetVector6Macro" return(GetVector6Macro);
00167 "vtkSetVectorMacro" return(SetVectorMacro);
00168 "vtkGetVectorMacro" return(GetVectorMacro);
00169 "vtkViewportCoordinateMacro" return(ViewportCoordinateMacro);
00170 "vtkWorldCoordinateMacro" return(WorldCoordinateMacro);
00171 "vtkTypeMacro" return(TypeMacro);
00172
00173 [0-9]+ { sscanf(yytext,"%d",&yylval.integer); return(NUM);}
00174
00175 \"[^\"]+\" {
00176 yylval.str = strdup(yytext + 1);
00177 yylval.str[strlen(yytext)-2] = '\0';
00178 return (STRING);
00179 }
00180
00181 ^"#"[^\n]*$ ;
00182
00183
00184 "vtk"[0-9a-zA-Z_]* {
00185 yylval.str = (char *)malloc(yyleng + 1);
00186 memcpy(yylval.str,yytext,yyleng);
00187 yylval.str[yyleng] = '\0';
00188 return (VTK_ID);
00189 }
00190
00191 [a-zA-Z_][0-9a-zA-Z_]* {
00192 yylval.str = (char *)malloc(yyleng + 1);
00193 memcpy(yylval.str,yytext,yyleng);
00194 yylval.str[yyleng] = '\0';
00195 return (ID);
00196 }
00197
00198 [\t\n ] ;
00199
00200
00201 "[" return (yytext[0]);
00202 "]" return (yytext[0]);
00203
00204
00205 [~{}] return (yytext[0]);
00206 [():] return (yytext[0]);
00207 [;*=] return (yytext[0]);
00208 [,&.] return (yytext[0]);
00209 [---] return (yytext[0]);
00210
00211 . return (OTHER);
00212 %%
00213
00214 /*
00215 * $Log: vtkParse.l,v $
00216 * Revision 1.2 2001/07/12 08:56:46 pfb
00217 * Now compiles.
00218 *
00219 *
00220 */