Alien-LibJIT

 view release on metacpan or  search on metacpan

libjit/dpas/dpas-scanner.l  view on Meta::CPAN

		lval->int_const.type = jit_type_uint;
	}
	else if(value <= (jit_ulong)jit_max_long)
	{
		lval->int_const.type = jit_type_long;
	}
	else
	{
		lval->int_const.type = jit_type_ulong;
	}
}

/*
 * Parse a decimal integer value.
 */
static void dpas_parse_decimal(const char *text, YYSTYPE *lval)
{
	jit_ulong value = 0;
	while(*text != '\0')
	{
		value = value * 10 + (jit_ulong)(*text - '0');
		++text;
	}
	lval->int_const.value = value;
	dpas_infer_type(lval);
}

/*
 * Parse a hexadecimal integer value.
 */
static void dpas_parse_hex(const char *text, YYSTYPE *lval)
{
	jit_ulong value = 0;
	while(*text != '\0')
	{
		if(*text >= '0' && *text <= '9')
		{
			value = value * 16 + (jit_ulong)(*text - '0');
		}
		else if(*text >= 'A' && *text <= 'F')
		{
			value = value * 16 + (jit_ulong)(*text - 'A' + 10);
		}
		else if(*text >= 'a' && *text <= 'f')
		{
			value = value * 16 + (jit_ulong)(*text - 'a' + 10);
		}
		++text;
	}
	lval->int_const.value = value;
	dpas_infer_type(lval);
}

/*
 * Forward declaration.
 */
static void dpas_skip_comment(int star_style);

%}

%option outfile="lex.yy.c"
%option noyywrap
%option nounput
%option case-insensitive

DIGIT			[0-9]
HEX			[0-9A-Fa-f]
IDALPHA			[a-zA-Z_]
EXPONENT		[Ee][+-]?{DIGIT}+
WHITE			[ \t\v\r\f]

%%

"<>"			{ RETURNTOK(K_NE); }
"<="			{ RETURNTOK(K_LE); }
">="			{ RETURNTOK(K_GE); }
":="			{ RETURNTOK(K_ASSIGN); }
".."			{ RETURNTOK(K_DOT_DOT); }
"**"			{ RETURNTOK(K_POW); }

"and"			{ RETURNTOK(K_AND); }
"array"			{ RETURNTOK(K_ARRAY); }
"begin"			{ RETURNTOK(K_BEGIN); }
"case"			{ RETURNTOK(K_CASE); }
"catch"			{ RETURNTOK(K_CATCH); }
"const"			{ RETURNTOK(K_CONST); }
"div"			{ RETURNTOK(K_DIV); }
"do"			{ RETURNTOK(K_DO); }
"downto"		{ RETURNTOK(K_DOWNTO); }
"else"			{ RETURNTOK(K_ELSE); }
"end"			{ RETURNTOK(K_END); }
"exit"			{ RETURNTOK(K_EXIT); }
"fastcall"		{ RETURNTOK(K_FASTCALL); }
"finally"		{ RETURNTOK(K_FINALLY); }
"for"			{ RETURNTOK(K_FOR); }
"forward"		{ RETURNTOK(K_FORWARD); }
"function"		{ RETURNTOK(K_FUNCTION); }
"goto"			{ RETURNTOK(K_GOTO); }
"if"			{ RETURNTOK(K_IF); }
"in"			{ RETURNTOK(K_IN); }
"label"			{ RETURNTOK(K_LABEL); }
"import"		{ RETURNTOK(K_IMPORT); }
"mod"			{ RETURNTOK(K_MOD); }
"module"		{ RETURNTOK(K_MODULE); }
"nil"			{ RETURNTOK(K_NIL); }
"not"			{ RETURNTOK(K_NOT); }
"of"			{ RETURNTOK(K_OF); }
"or"			{ RETURNTOK(K_OR); }
"packed"		{ RETURNTOK(K_PACKED); }
"pow"			{ RETURNTOK(K_POW); }
"procedure"		{ RETURNTOK(K_PROCEDURE); }
"program"		{ RETURNTOK(K_PROGRAM); }
"record"		{ RETURNTOK(K_RECORD); }
"repeat"		{ RETURNTOK(K_REPEAT); }
"set"			{ RETURNTOK(K_SET); }
"shl"			{ RETURNTOK(K_SHL); }
"shr"			{ RETURNTOK(K_SHR); }
"sizeof"		{ RETURNTOK(K_SIZEOF); }
"stdcall"		{ RETURNTOK(K_STDCALL); }
"then"			{ RETURNTOK(K_THEN); }
"throw"			{ RETURNTOK(K_THROW); }



( run in 0.756 second using v1.01-cache-2.11-cpan-13bb782fe5a )