head	1.26;
access;
symbols
	release_4_2:1.26
	aix_ok:1.25
	Version_2_1:1.17
	Version_2:1.13
	C_Demo_1:1.7;
locks; strict;


1.26
date	94.02.02.01.18.54;	author sunita;	state Exp;
branches;
next	1.25;

1.25
date	93.01.16.03.14.59;	author aoki;	state Exp;
branches;
next	1.24;

1.24
date	92.07.28.19.11.28;	author mao;	state Exp;
branches;
next	1.23;

1.23
date	92.06.27.18.48.47;	author mao;	state Exp;
branches;
next	1.22;

1.22
date	92.06.23.18.56.48;	author glass;	state Exp;
branches;
next	1.21;

1.21
date	91.09.08.16.21.39;	author glass;	state Exp;
branches;
next	1.20;

1.20
date	91.08.14.17.04.15;	author kemnitz;	state Exp;
branches;
next	1.19;

1.19
date	91.03.27.23.19.21;	author kemnitz;	state Exp;
branches;
next	1.18;

1.18
date	91.03.27.16.58.52;	author choi;	state Exp;
branches;
next	1.17;

1.17
date	90.10.24.10.34.53;	author choi;	state Exp;
branches;
next	1.16;

1.16
date	90.10.19.11.23.13;	author goh;	state Exp;
branches;
next	1.15;

1.15
date	90.08.22.10.25.40;	author goh;	state Exp;
branches;
next	1.14;

1.14
date	90.08.17.13.56.29;	author cimarron;	state Exp;
branches;
next	1.13;

1.13
date	90.04.29.11.33.48;	author goh;	state Version_2;
branches;
next	1.12;

1.12
date	90.04.20.07.54.16;	author goh;	state Exp;
branches;
next	1.11;

1.11
date	90.04.12.23.30.33;	author goh;	state Exp;
branches;
next	1.10;

1.10
date	90.03.12.13.52.04;	author goh;	state Exp;
branches;
next	1.9;

1.9
date	90.01.31.17.47.50;	author kemnitz;	state Exp;
branches;
next	1.8;

1.8
date	89.12.03.18.31.42;	author goh;	state Exp;
branches;
next	1.7;

1.7
date	89.09.05.16.51.47;	author mao;	state C_Demo_1;
branches;
next	1.6;

1.6
date	89.08.07.19.07.59;	author goh;	state Exp;
branches;
next	1.5;

1.5
date	89.08.01.17.35.11;	author goh;	state Exp;
branches;
next	1.4;

1.4
date	89.07.31.11.44.17;	author goh;	state Exp;
branches;
next	1.3;

1.3
date	89.07.25.13.06.36;	author goh;	state Exp;
branches;
next	1.2;

1.2
date	89.03.02.14.03.18;	author goh;	state Stab;
branches;
next	1.1;

1.1
date	89.02.22.16.12.57;	author goh;	state Exp;
branches;
next	;


desc
@@


1.26
log
@added optional '-' in the definition for integer and real.
@
text
@%{
static char *scan_l =
	"$Header: /private/src/postgres/src/backend/parser/RCS/scan.l,v 1.25 1993/01/16 03:14:59 aoki Exp sunita $";
/**********************************************************************
  scan.l
  lexical scanner for POSTGRES 
 **********************************************************************/

#include <ctype.h>
#include <math.h>

#include "parse.h"
#include "nodes/pg_lisp.h"
#include "parser/atoms.h"


#undef input
#undef unput

extern LispValue yylval;
%}

digit		[0-9]
letter		[_A-Za-z]
letter_or_digit	[_A-Za-z0-9]

identifier	{letter}{letter_or_digit}*

self		[,()\[\].;$\:\+\-\*\/\<\>\=\|]
op_and_self	[\~\!\@@\#\%\^\&\|\`\?\$\:\+\-\*\/\<\>\=]
op_only		[\~\!\@@\#\%\^\&\`\?]

operator	({op_and_self}{op_and_self}+)|{op_only}+
string		\"
specialstr	\`
character	"'"

integer		-?{digit}+
real		-?{digit}+\.{digit}+([Ee][-+]?{digit}+)?

param		\${integer}

comment		"/*"

space		[ \t\n\f]
other		.

%%
{comment}	{ scancmnt();		}
"::"		{ return TYPECAST;	}
{specialstr}	{
			char buf[8192];
			scanspecial(buf,sizeof(buf));
			yylval = lispString(buf);
			return (SCONST);
		}
{self}		{ return (yytext[0]);	}
{operator}	{
			yylval = lispString(yytext);
			return (Op);
		}
{param}	        {       yylval = lispInteger(atoi(&yytext[1]));		
	                return (PARAM);
                }
{integer}	{
			yylval = lispInteger(atoi(yytext));		
			return (ICONST);
		}
{real}		{
			yylval = lispFloat(atof(yytext));
			return (FCONST);
		}
{string}	{
			char buf[8192];
			scanstr(buf,sizeof(buf));
			yylval = lispString(buf);
			return (SCONST);
		}

{character}	{
			char buf[2];
			scanchar(buf);
			yylval = lispString(buf);
			return (CCONST);
		}
{identifier}	{
			ScanKeyword	*keyword;

			keyword = ScanKeywordLookup(yytext);
			if (keyword != NULL) {
				yylval = lispAtom(keyword->name);
				return (keyword->value);
			} else {
				yylval = (LispValue) lispName(yytext);
				return (IDENT);
			}
		}
{space}		{ /* void */		}
{other}		{ return (yytext[0]);	}

%%
@


1.25
log
@removed references to utils/fmgr.h and parser/parse.h
@
text
@d3 1
a3 1
	"$Header: /home2/aoki/postgres/src/backend/parser/RCS/scan.l,v 1.24 1992/07/28 19:11:28 mao Exp aoki $";
d38 2
a39 2
integer		{digit}+
real		{digit}+\.{digit}+([Ee][-+]?{digit}+)?
@


1.24
log
@unary minus handled by parser, not lexter
@
text
@d3 1
a3 1
	"$Header: /private/mao/postgres/src/parser/RCS/scan.lex,v 1.23 1992/06/27 18:48:47 mao Exp mao $";
d12 1
a12 1
#include "parser/parse.h"
@


1.23
log
@parser support for parameters and nested dots
@
text
@d3 1
a3 1
	"$Header: /private/mao/postgres/src/parser/RCS/scan.lex,v 1.22 1992/06/23 18:56:48 glass Exp mao $";
a28 1
param		\${digit}
d38 2
a39 2
integer		[-+]?{digit}+
real		[-+]?{digit}+\.{digit}+([Ee][-+]?{digit}+)?
d41 2
a101 35

/**************************************************
  MakeUpper 
  - destructively changes the inputstr, converting
  any lower-case characters to their corresponding
  upper case equivalents
 **************************************************/
/*
	XXX - unused code, remove sometime in the future

MakeUpper(mixedstr)
	char *mixedstr;
{
	while(*mixedstr != NULL )  {
		if(islower(*mixedstr)) 
			*mixedstr = toupper(*mixedstr);
		mixedstr++;
	}
}
*/

/*
	XXX - unused code, remove sometime in the future

MakeLower(mixedstr)
	char *mixedstr;
{
	while(*mixedstr != NULL )  {
		if(isupper(*mixedstr)) 
			*mixedstr = tolower(*mixedstr);
		mixedstr++;
	}
}
*/

@


1.22
log
@nested dot crap
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.21 91/09/08 16:21:39 glass Exp Locker: glass $";
a29 1
param_named	\$\.{identifier}
a62 3
                }
{param_named}   {       yylval = lispString(&yytext[2]);
			return (PARAM);
@


1.21
log
@initial postquel function checkin
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.20 91/08/14 17:04:15 kemnitz Exp Locker: glass $";
d30 1
d64 3
@


1.20
log
@got rid of array token so it could be used by aggregates.
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.19 91/03/27 23:19:21 kemnitz Exp Locker: kemnitz $";
d29 1
d61 3
d65 1
a65 1
			yylval = lispInteger(atoi(yytext));
@


1.19
log
@{string} now == to "string"
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.18 91/03/27 16:58:52 choi Exp Locker: kemnitz $";
a36 1
array		\{
a70 6
			yylval = lispString(buf);
			return (SCONST);
		}
{array}		{
			char buf[8192];
			scanarray(buf,sizeof(buf));
@


1.18
log
@added support arrays
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.17 90/10/24 10:34:53 choi Exp Locker: choi $";
d79 1
a79 1
			return (ARRAY);
@


1.17
log
@typecasted lispName(yytext) to LispValue to get rid of ccom warning.
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.16 90/10/19 11:23:13 goh Exp Locker: choi $";
d37 1
d74 6
@


1.16
log
@changed call to lispString to lispName
which does length-bounds checking etc.

- jeff
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.15 90/08/22 10:25:40 goh Exp $";
d89 1
a89 1
				yylval = lispName(yytext);
@


1.15
log
@moved the "|" character to the "self" category instead of an
operator category
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.14 90/08/17 13:56:29 cimarron Exp $";
d89 1
a89 1
				yylval = lispString(yytext);
@


1.14
log
@added pathnames to #include statements
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.13 90/04/29 11:33:48 goh Version_2 Locker: cimarron $";
d29 3
a31 3
self		[,()\[\].;$\:\+\-\*\/\<\>\=]
op_and_self	[\~\!\@@\#\%\^\&\|\`\|\?\$\:\+\-\*\/\<\>\=]
op_only		[\~\!\@@\#\%\^\&\|\`\|\?]
@


1.13
log
@added "~" to operators as requested by mao
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.12 90/04/20 07:54:16 goh Exp Locker: goh $";
d9 7
a15 5
#include "parse.h"
#include "pg_lisp.h"
#include "ctype.h"
#include "math.h"
#include "atoms.h"
@


1.12
log
@moved atoms.h so that "String" is not undefined.
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.11 90/04/12 23:30:33 goh Exp Locker: goh $";
d28 2
a29 2
op_and_self	[\!\@@\#\%\^\&\|\`\|\?\$\:\+\-\*\/\<\>\=]
op_only		[\!\@@\#\%\^\&\|\`\|\?]
@


1.11
log
@works with gram.y,1.61 to fix typecasting bug
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.10 90/03/12 13:52:04 goh Exp Locker: goh $";
a8 1
#include "atoms.h"
d13 1
d33 1
d47 6
d72 1
@


1.10
log
@first integration checkin
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.8 89/12/03 18:31:42 goh Exp Locker: goh $";
d28 2
a29 1
operator	[\!\@@\#\%\^\&\|\`\|\?]+
d31 1
d45 1
@


1.9
log
@Fixed atof problem (by including math.h)
@
text
@d27 2
a28 2
self		[,()\[\].;$\:]
operator	[\!\@@\#\%\^\&\*\-\=\+\|\`\|\<\>\/\?]+
d53 1
a53 1
			yylval = lispFloat((double) atof(yytext));
@


1.8
log
@minor fix so that atoms are made instead of integers when
we get a keyword ... corresponding fix to lispdep.c/CAtom,CInteger 
have been made so that it doesn't break existing code...
the correct test should now be "atom(foo)" instead of Tag == LISP_ATOM
@
text
@d3 1
a3 1
	"$Header: RCS/scan.lex,v 1.7 89/09/05 16:51:47 mao C_Demo_1 $";
d13 1
d53 1
a53 1
			yylval = lispFloat(atof(yytext));
@


1.7
log
@Working version of C-only demo
@
text
@d3 1
a3 1
	"$Header: /usr6/postgres/mao/postgres/src/parser/RCS/scan.lex,v 1.6 89/08/07 19:07:59 goh Exp $";
d26 2
a27 2
self		[,()\[\].;$]
operator	[\!\@@\#\%\^\&\*\-\=\+\|\`\|\:\<\>\/\?]+
d72 1
a72 1
				yylval = lispInteger(keyword->value);
@


1.6
log
@moved scan keywords to lib/C, so that it can become
part of parser/planner interface
@
text
@d3 1
a3 1
	"$Header: scan.lex,v 1.5 89/08/01 17:35:11 goh Locked $";
@


1.5
log
@*** empty log message ***
@
text
@d3 1
a3 1
	"$Header: scan.lex,v 1.4 89/07/31 11:44:17 goh Locked $";
d9 1
a10 2
/*#include "catalog_utils.h"*/
/*#include "global.h"*/
a15 8
/*
#define lengthof(byte_array)	(sizeof(byte_array) / sizeof((byte_array)[0]))
#define endof(byte_array)	(&byte_array[lengthof(byte_array)])
*/
typedef struct ScanKeyword {
	char	*name;
	int	value;
} ScanKeyword;
a16 2
ScanKeyword	*ScanKeywordLookup();

a83 109
/*
 * List of (keyword-name, keyword-token-value) pairs.
 *
 * NOTE: This list must be sorted, because binary
 *	 search is used to locate entries.
 */
ScanKeyword	ScanKeywords[] = {
	/* name			value		*/
	{ "abort",		ABORT_TRANS	},
	{ "addattr",		ADD_ATTR	},
	{ "after",		AFTER		},
	{ "all",		ALL		},
	{ "always",		ALWAYS		},
	{ "and",		AND		},
	{ "append",		APPEND		},
	{ "archive",		ARCHIVE		},
	{ "arg",		ARG		},
	{ "ascending",		ASCENDING	},
	{ "attachas",		ATTACH_AS	},
	{ "backward",		BACKWARD	},
	{ "before",		BEFORE		},
	{ "begin",		BEGIN_TRANS	},
	{ "binary",		BINARY		},
	{ "by",			BY		},
	{ "close",		CLOSE		},
	{ "cluster",		CLUSTER		},
	{ "copy",		COPY		},
	{ "create",		CREATE		},
	{ "define",		DEFINE		},
	{ "delete",		DELETE		},
	{ "demand",		DEMAND		},
	{ "descending",		DESCENDING	},
	{ "destroy",		DESTROY		},
	{ "empty",		EMPTY		},
	{ "end",		END_TRANS	},
	{ "execute",		EXECUTE		},
	{ "fetch",		FETCH		},
	{ "forward",		FORWARD		},
	{ "from",		FROM		},
	{ "function",		FUNCTION	},
	{ "heavy",		HEAVY		},
	{ "in",			IN		},
	{ "index",		INDEX		},
	{ "indexable",		INDEXABLE	},
	{ "inherits",		INHERITS	},
	{ "input_proc",		INPUTPROC	},
	{ "intersect",		INTERSECT	},
	{ "into",		INTO		},
	{ "is",			IS		},
	{ "key",		KEY		},
	{ "leftouter",		LEFTOUTER	},
	{ "light",		LIGHT		},
	{ "merge",		MERGE		},
	{ "move",		MOVE		},
	{ "never",		NEVER		},
	{ "none",		NONE		},
	{ "nonulls",		NONULLS		},
	{ "not",		NOT		},
	{ "on",			ON		},
	{ "once",		ONCE		},
	{ "operator",		OPERATOR	},
	{ "or",			OR		},
	{ "output_proc",	OUTPUTPROC	},
	{ "portal",		PORTAL		},
	{ "priority",		PRIORITY	},
	{ "purge",		PURGE		},
	{ "quel",		QUEL		},
	{ "remove",		REMOVE		},
	{ "rename",		RENAME		},
	{ "replace",		REPLACE		},
	{ "retrieve",		RETRIEVE	},
	{ "rightouter",		RIGHTOUTER	},
	{ "rule",		RULE		},
	{ "sort",		SORT		},
	{ "to",			TO		},
	{ "type",		P_TYPE		},
	{ "transaction",	TRANSACTION	},
	{ "union",		UNION		},
	{ "unique",		UNIQUE		},
	{ "using",		USING		},
	{ "version",		NEWVERSION	},
	{ "where",		WHERE		},
	{ "with",		WITH		},
	{ "NULL",		PNULL		},
};

ScanKeyword *
ScanKeywordLookup(text)
	char	*text;
{
	ScanKeyword	*low	= &ScanKeywords[0];
	ScanKeyword	*high	= endof(ScanKeywords) - 1;
	ScanKeyword	*middle;
	int		difference;

	while (low <= high) {
		middle = low + (high - low) / 2;
		difference = strcmp(middle->name, text);
		if (difference == 0)
			return (middle);
		else if (difference < 0)
			low = middle + 1;
		else
			high = middle - 1;
	}

	return (NULL);
}

d90 2
d102 1
d104 3
d116 1
a116 3



@


1.4
log
@changed to use the stuff in the "nodes" package,
notably, uses MakeParam instead of lisp_make_param()
@
text
@d3 1
a3 1
	"$Header: scan.lex,v 1.3 89/07/25 13:06:36 goh Locked $";
d12 1
a12 1
#include "lispdep.h"
@


1.3
log
@*** empty log message ***
@
text
@d3 1
a3 1
	"$Header: scan.lex,v 1.2 89/03/02 14:03:18 goh Locked $";
d17 1
a17 1

d20 1
a20 1

@


1.2
log
@minor fix
@
text
@d3 1
a3 1
	"$Header: scan.lex,v 1.1 89/02/22 16:12:57 goh Exp $";
d83 1
a83 8
#ifdef FRANZ43
				MakeUpper(yytext);
#endif
#ifdef ALLEGRO
				MakeLower(yytext);
#endif
				yylval = lispAtom(yytext);
				MakeLower(yytext);
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
	"$Header: scan.l,v 1.1 88/12/31 13:07:26 goh Locked $";
d83 4
d88 1
d90 1
@
