Blame tools/wml/wmllex.l

Packit b099d7
%{
Packit b099d7
/*
Packit b099d7
 * Motif
Packit b099d7
 *
Packit b099d7
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
Packit b099d7
 *
Packit b099d7
 * These libraries and programs are free software; you can
Packit b099d7
 * redistribute them and/or modify them under the terms of the GNU
Packit b099d7
 * Lesser General Public License as published by the Free Software
Packit b099d7
 * Foundation; either version 2 of the License, or (at your option)
Packit b099d7
 * any later version.
Packit b099d7
 *
Packit b099d7
 * These libraries and programs are distributed in the hope that
Packit b099d7
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
Packit b099d7
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
Packit b099d7
 * PURPOSE. See the GNU Lesser General Public License for more
Packit b099d7
 * details.
Packit b099d7
 *
Packit b099d7
 * You should have received a copy of the GNU Lesser General Public
Packit b099d7
 * License along with these librararies and programs; if not, write
Packit b099d7
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
Packit b099d7
 * Floor, Boston, MA 02110-1301 USA
Packit b099d7
 */
Packit b099d7
/*
Packit b099d7
 * HISTORY
Packit b099d7
 */
Packit b099d7
#if defined(__STDC__)
Packit b099d7
#include <string.h>
Packit b099d7
#endif
Packit b099d7
Packit b099d7
#ifndef XmConst
Packit b099d7
#if defined(__STDC__) || !defined( NO_CONST )
Packit b099d7
#define XmConst const
Packit b099d7
#else
Packit b099d7
#define XmConst
Packit b099d7
#endif /* __STDC__ */
Packit b099d7
#endif /* XmConst */
Packit b099d7
Packit b099d7
#ifdef YY_BUFFER_SIZE
Packit b099d7
#define BUF_SIZE YY_BUFFER_SIZE
Packit b099d7
#else
Packit b099d7
#define BUF_SIZE 8192
Packit b099d7
#endif
Packit b099d7
Packit b099d7
char            yystringval[BUF_SIZE];      /* any string value */
Packit b099d7
char            yynameval[BUF_SIZE];         /* any identifier (name) */
Packit b099d7
int             yytknval1;              /* terminal token value 1 */
Packit b099d7
int             yytknval2;              /* terminal token value 2 */
Packit b099d7
Packit b099d7
%}
Packit b099d7
Packit b099d7
%p 3000
Packit b099d7
%%
Packit b099d7
Packit b099d7
[ \t\f]		{}
Packit b099d7
Packit b099d7
[\n]		{ wml_line_count += 1; }
Packit b099d7
Packit b099d7
"Class"			{ return CLASS; }
Packit b099d7
"Resource"		{ return RESOURCE; }
Packit b099d7
"DataType"		{ return DATATYPE; }
Packit b099d7
"ControlList"		{ return CONTROLLIST; }
Packit b099d7
"EnumerationSet"	{ return ENUMERATIONSET; }
Packit b099d7
"EnumerationValue"	{ return ENUMERATIONVALUE; }
Packit b099d7
"CharacterSet"		{ return CHARACTERSET; }
Packit b099d7
"Child"			{ return CHILD; }
Packit b099d7
Packit b099d7
"DocName"		{ return DOCNAME; }
Packit b099d7
"ConvenienceFunction"	{ return CONVFUNC; }
Packit b099d7
"Alias"			{ return ALIAS; }
Packit b099d7
"Type"			{ return TYPE; }
Packit b099d7
"ResourceLiteral"	{ return RESOURCELITERAL; }
Packit b099d7
"Related"		{ return RELATED; }
Packit b099d7
"InternalLiteral"	{ return INTERNALLITERAL; }
Packit b099d7
"Constraint"		{ return CONSTRAINT; }
Packit b099d7
"Exclude"		{ return EXCLUDE;}
Packit b099d7
"Resources"		{ return RESOURCES; }
Packit b099d7
"SuperClass"		{ return SUPERCLASS; }
Packit b099d7
"ParentClass"		{ return PARENTCLASS; }
Packit b099d7
"Controls"		{ return CONTROLS; }
Packit b099d7
"WidgetClass"		{ return WIDGETCLASS; }
Packit b099d7
"DialogClass"		{ return DIALOGCLASS; }
Packit b099d7
"Default"		{ return DEFAULT; }
Packit b099d7
"EnumLiteral"		{ return ENUMLITERAL; }
Packit b099d7
"XmStringCharsetName"	{ return XMSTRINGCHARSETNAME; }
Packit b099d7
"FontListElementTag"	{ return XMSTRINGCHARSETNAME; }
Packit b099d7
"Direction"		{ return DIRECTION; }
Packit b099d7
"ParseDirection"	{ return PARSEDIRECTION; }
Packit b099d7
"CharacterSize"		{ return CHARACTERSIZE; }
Packit b099d7
"ControlsMapToResource"	{ return CTRLMAPSRESOURCE; }
Packit b099d7
"Children"		{ return CHILDREN; }
Packit b099d7
Packit b099d7
"MetaClass"		{ return METACLASS;}
Packit b099d7
"Widget"		{ return WIDGET;}
Packit b099d7
"Gadget"		{ return GADGET;}
Packit b099d7
"Argument"		{ return ARGUMENT;}
Packit b099d7
"Reason"		{ return REASON;}
Packit b099d7
"Constraint"		{ return CONSTRAINT;}
Packit b099d7
"SubResource"		{ return SUBRESOURCE;}
Packit b099d7
"True"			{ return ATTRTRUE; }
Packit b099d7
"False"			{ return ATTRFALSE; }
Packit b099d7
"LeftToRight"		{ return LEFTTORIGHT; }
Packit b099d7
"RightToLeft"		{ return RIGHTTOLEFT; }
Packit b099d7
"OneByte"		{ return ONEBYTE; }
Packit b099d7
"TwoByte"		{ return TWOBYTE; }
Packit b099d7
"MixedOneAndTwoByte"	{ return MIXED1_2BYTE; }
Packit b099d7
Packit b099d7
":"			{ return COLON; }
Packit b099d7
";"			{ return SEMICOLON; }
Packit b099d7
"="			{ return EQUALS; }
Packit b099d7
"{"			{ return LBRACE; }
Packit b099d7
"}"			{ return RBRACE; }
Packit b099d7
Packit b099d7
"!"[^\n]*	{}
Packit b099d7
Packit b099d7
"#"[^\n]*	{}
Packit b099d7
Packit b099d7
[a-zA-Z_][a-zA-Z0-9$_]* {	/* string without quotes	*/
Packit b099d7
	strcpy (yystringval, (XmConst char *) yytext);
Packit b099d7
	return STRING;
Packit b099d7
	}
Packit b099d7
Packit b099d7
\"[^"\n]*\\	{	/* escaped character in the string 	*/
Packit b099d7
		yymore();
Packit b099d7
		}
Packit b099d7
Packit b099d7
\"[^"\n]*\"	{	/* String in quotes	*/
Packit b099d7
		strncpy(yystringval, (XmConst char *) yytext+1, yyleng - 2);
Packit b099d7
		yystringval[yyleng-2] = '\0' ;
Packit b099d7
		return STRING;
Packit b099d7
		}
Packit b099d7
\"[^"\n]*	{
Packit b099d7
		printf ("\nUnterminated string near %s, line %d",
Packit b099d7
			yytext, wml_line_count);
Packit b099d7
		return ERRORTOKEN;
Packit b099d7
		}
Packit b099d7
Packit b099d7
.	{
Packit b099d7
	printf ("\nEncountered illegal character '%c', line %d",
Packit b099d7
		yytext[0], wml_line_count);
Packit b099d7
	return ERRORTOKEN;
Packit b099d7
	}