File: XdmfExpr.l

package info (click to toggle)
vtk6 6.1.0+dfsg2-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 165,164 kB
  • ctags: 226,428
  • sloc: cpp: 1,354,490; ansic: 730,748; python: 227,134; tcl: 48,285; xml: 8,290; yacc: 4,832; java: 3,827; perl: 3,108; lex: 1,809; sh: 1,437; asm: 471; makefile: 229
file content (125 lines) | stat: -rw-r--r-- 2,315 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
%{
#undef input
#undef output
#undef unput
#include <XdmfObject.h>
#include <XdmfExpr.h>
#include <XdmfArray.h>
/* Geneated by bison */
#include "XdmfExprYacc.tab.h"
// #include <ice.h>
#include <math.h>
#define YY_NEVER_INTERACTIVE 1

#ifndef yylval
#define yylval dice_yylval
extern YYSTYPE dice_yylval;
#endif


#if defined( _WIN32 ) && !defined( __CYGWIN__ )
/* Handle Windows properly */
#  include <io.h>
#  define YY_NO_UNISTD_H
#  define isatty _isatty
#endif

static int
GetPointerFromString( char *_c, void **_ptr ){
XDMF_BIG_INT	_p;

_p = 0;
if ( strcmp( _c, "NULL" ) == 0 ){
	*_ptr = NULL;
	return( 0 );
	}

  /* Pointer values must start with leading underscore */
  if (*_c == '_') {
	*_ptr = TagNameToArray( _c );
	if( *_ptr == NULL ) {
		return( 1 );
	}
	return( 0 );
/* Old
      _c++;
      while (*_c) {
	  if ((*_c >= '0') && (*_c <= '9'))
	    _p = (_p << 4) + (*_c - '0');
	  else if ((*_c >= 'a') && (*_c <= 'f'))
	    _p = (_p << 4) + ((*_c - 'a') + 10);
	  else
	    break;
	  _c++;
      }
*/

   } else {
	*_ptr = NULL;
	return( 1 );
  }

*_ptr = *((void **) &_p);
return( 0 );
}

%}

%%
join { return JOIN; }
JOIN { return JOIN; }
Join { return JOIN; }
where { return WHERE; }
WHERE { return WHERE; }
Where { return WHERE; }
index { return INDEX; }
INDEX { return INDEX; }
Index { return INDEX; }
">>" { return GTGT; }
"<<" { return LTLT; }
"==" { return EQEQ; }
"<" { return LT; }
"<=" { return LE; }
">" { return GT; }
">=" { return GE; }
"!=" { return NE; }
([-+]?[0-9]+)	{
	yylval.IntegerValue = atoi(yytext);
	return tokINTEGER;
	}
([-+]?[0-9]+|([-+]?[0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?) {
	yylval.DoubleValue = atof(yytext);
	return lFLOAT;
	}
_+[0-9a-zA-Z_]*"_"* {
	if( GetPointerFromString( yytext, &yylval.ArrayPointer ) ){
		printf("Bad Pointer Conversion\n");
		yylval.ArrayPointer = NULL;
	}
	return tokARRAY;
	}
[A-Za-z][A-Za-z0-9]* {
	/* Symbol */
	XdmfExprSymbol	*sp;

	sp = XdmfExprSymbolLookup( yytext );
	yylval.Symbol = sp;
	return( NAME );
	}
[ \t]	;
\n	return 0;
. 	return yytext[0];
%%

extern int	XdmfExprInput();
extern void	XdmfExprUnput( int c );
extern void	XdmfExprOutput( int c );

#define input() XdmfExprInput()
#define unput(c) XdmfExprUnput((c))
#define output(c) XdmfExprOutput( ( c ) )

void XdmfYYUnput(int c, char* buf_ptr )
{
  yyunput(c, buf_ptr);
}