mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
DtMmdb: repair lex and yacc source in StyleSheet dir.
This commit is contained in:
parent
206632cfbb
commit
ef6d06fb88
11 changed files with 80 additions and 4999 deletions
|
@ -29,3 +29,27 @@ libStyleSheet_la_SOURCES = Attribute.C \
|
|||
defToken.C \
|
||||
style.C \
|
||||
tokenStyle.C
|
||||
|
||||
AM_YFLAGS = -l -d
|
||||
AM_LFLAGS = -8 -s
|
||||
|
||||
CLEANFILES = defParser.C \
|
||||
defParser.tab.h \
|
||||
defToken.C \
|
||||
style.C \
|
||||
style.tab.h \
|
||||
tokenStyle.C
|
||||
|
||||
defParser.C: defParser.yy
|
||||
$(YACC) $(AM_YFLAGS) -p defParser -b defParser $<
|
||||
mv defParser.tab.c $@
|
||||
|
||||
defToken.C: defToken.ll
|
||||
$(LEX) $(AM_LFLAGS) -P defParser -o $@ $<
|
||||
|
||||
style.C: style.yy
|
||||
$(YACC) $(AM_YFLAGS) -p style -b style $<
|
||||
mv style.tab.c style.C
|
||||
|
||||
tokenStyle.C: tokenStyle.ll
|
||||
$(LEX) $(AM_LFLAGS) -P style -o $@ $<
|
||||
|
|
|
@ -1,528 +0,0 @@
|
|||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these libraries and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
// $TOG: defParser.C /main/5 1997/12/23 11:16:25 bill $
|
||||
#ifndef lint
|
||||
__attribute__((unused))
|
||||
static const char defParsersccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
|
||||
#endif
|
||||
#define defParserBYACC 1
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#include "Debug.h"
|
||||
#include "FeatureDefDictionary.h"
|
||||
|
||||
#ifdef alloca
|
||||
# undef alloca
|
||||
#endif
|
||||
#define alloca(x) (malloc(x))
|
||||
|
||||
def_list_t* g_def_list = 0;
|
||||
|
||||
extern void defParsererror(char*);
|
||||
extern int defParserlex();
|
||||
|
||||
#undef defParserwrap
|
||||
|
||||
typedef union
|
||||
{
|
||||
unsigned char charData;
|
||||
unsigned char* charPtrData;
|
||||
int intData;
|
||||
float realData;
|
||||
FeatureValue* valueData;
|
||||
|
||||
defv_t* valueListPtrData;
|
||||
TypeValues* typeValuesPtrData;
|
||||
type_values_list_t* typeValuesListPtrData;
|
||||
|
||||
def_list_t* defListPtrData;
|
||||
FeatureDef* defPtrData;
|
||||
|
||||
} defParserSTYPE;
|
||||
#define STAR 257
|
||||
#define COMMA 258
|
||||
#define COLON 259
|
||||
#define SEMI_COLON 260
|
||||
#define FSOPEN 261
|
||||
#define FSCLOSE 262
|
||||
#define OPER_parenopen 263
|
||||
#define OPER_parenclose 264
|
||||
#define INTEGER 265
|
||||
#define REAL 266
|
||||
#define NORMAL_STRING 267
|
||||
#define QUOTED_STRING 268
|
||||
#define REF_NAME 269
|
||||
#define TYPE 270
|
||||
#define ValueListOpt 271
|
||||
#define defParserERRCODE 256
|
||||
short defParserlhs[] = { -1,
|
||||
0, 11, 11, 6, 6, 6, 6, 8, 10, 7,
|
||||
9, 1, 5, 5, 4, 4, 3, 3, 2, 2,
|
||||
2,
|
||||
};
|
||||
short defParserlen[] = { 2,
|
||||
1, 2, 1, 1, 1, 1, 1, 4, 4, 2,
|
||||
2, 1, 3, 1, 4, 1, 3, 1, 1, 1,
|
||||
1,
|
||||
};
|
||||
short defParserdefred[] = { 0,
|
||||
0, 12, 0, 0, 3, 6, 4, 7, 5, 0,
|
||||
11, 0, 10, 0, 2, 0, 14, 0, 0, 0,
|
||||
0, 9, 8, 19, 21, 20, 18, 0, 13, 0,
|
||||
15, 17,
|
||||
};
|
||||
short defParserdgoto[] = { 3,
|
||||
4, 27, 28, 17, 18, 5, 6, 7, 8, 9,
|
||||
10,
|
||||
};
|
||||
short defParsersindex[] = { -256,
|
||||
-258, 0, 0, -240, 0, 0, 0, 0, 0, -256,
|
||||
0, -262, 0, -256, 0, -249, 0, -254, -257, -250,
|
||||
-262, 0, 0, 0, 0, 0, 0, -251, 0, -250,
|
||||
0, 0,
|
||||
};
|
||||
short defParserrindex[] = { 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
|
||||
0, 0, 0, 0, 0, -236, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0,
|
||||
};
|
||||
short defParsergindex[] = { 0,
|
||||
0, -13, 0, 2, 0, -7, 0, 0, 0, 0,
|
||||
11,
|
||||
};
|
||||
#define defParserTABLESIZE 25
|
||||
short defParsertable[] = { 1,
|
||||
1, 11, 15, 21, 23, 22, 30, 16, 1, 2,
|
||||
2, 15, 31, 20, 24, 25, 32, 26, 12, 13,
|
||||
14, 16, 29, 16, 19,
|
||||
};
|
||||
short defParsercheck[] = { 257,
|
||||
257, 260, 10, 258, 262, 260, 258, 270, 0, 267,
|
||||
267, 19, 264, 263, 265, 266, 30, 268, 259, 260,
|
||||
261, 258, 21, 260, 14,
|
||||
};
|
||||
#define defParserFINAL 3
|
||||
#ifndef defParserDEBUG
|
||||
#define defParserDEBUG 0
|
||||
#endif
|
||||
#define defParserMAXTOKEN 271
|
||||
#if defParserDEBUG
|
||||
char *defParsername[] = {
|
||||
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"STAR","COMMA","COLON",
|
||||
"SEMI_COLON","FSOPEN","FSCLOSE","OPER_parenopen","OPER_parenclose","INTEGER",
|
||||
"REAL","NORMAL_STRING","QUOTED_STRING","REF_NAME","TYPE","ValueListOpt",
|
||||
};
|
||||
char *defParserrule[] = {
|
||||
"$accept : featureDef",
|
||||
"featureDef : DefList",
|
||||
"DefList : DefList Def",
|
||||
"DefList : Def",
|
||||
"Def : CompositeDef",
|
||||
"Def : PrimitiveDef",
|
||||
"Def : DefReference",
|
||||
"Def : WildCardDef",
|
||||
"CompositeDef : Name FSOPEN DefList FSCLOSE",
|
||||
"PrimitiveDef : Name COLON TypeValuesList SEMI_COLON",
|
||||
"DefReference : Name SEMI_COLON",
|
||||
"WildCardDef : STAR SEMI_COLON",
|
||||
"Name : NORMAL_STRING",
|
||||
"TypeValuesList : TypeValuesList COMMA TypeValues",
|
||||
"TypeValuesList : TypeValues",
|
||||
"TypeValues : TYPE OPER_parenopen ValueList OPER_parenclose",
|
||||
"TypeValues : TYPE",
|
||||
"ValueList : ValueList COMMA Value",
|
||||
"ValueList : Value",
|
||||
"Value : INTEGER",
|
||||
"Value : QUOTED_STRING",
|
||||
"Value : REAL",
|
||||
};
|
||||
#endif
|
||||
#define defParserclearin (defParserchar=(-1))
|
||||
#define defParsererrok (defParsererrflag=0)
|
||||
#ifdef defParserSTACKSIZE
|
||||
#ifndef defParserMAXDEPTH
|
||||
#define defParserMAXDEPTH defParserSTACKSIZE
|
||||
#endif
|
||||
#else
|
||||
#ifdef defParserMAXDEPTH
|
||||
#define defParserSTACKSIZE defParserMAXDEPTH
|
||||
#else
|
||||
#define defParserSTACKSIZE 500
|
||||
#define defParserMAXDEPTH 500
|
||||
#endif
|
||||
#endif
|
||||
int defParserdebug;
|
||||
int defParsernerrs;
|
||||
int defParsererrflag;
|
||||
int defParserchar;
|
||||
short *defParserssp;
|
||||
defParserSTYPE *defParservsp;
|
||||
defParserSTYPE defParserval;
|
||||
defParserSTYPE defParserlval;
|
||||
short defParserss[defParserSTACKSIZE];
|
||||
defParserSTYPE defParservs[defParserSTACKSIZE];
|
||||
#define defParserstacksize defParserSTACKSIZE
|
||||
|
||||
/*
|
||||
void defParsererror(char *errorstr)
|
||||
{
|
||||
cerr << errorstr ;
|
||||
}
|
||||
*/
|
||||
#define defParserABORT goto defParserabort
|
||||
#define defParserACCEPT goto defParseraccept
|
||||
#define defParserERROR goto defParsererrlab
|
||||
#if defParserDEBUG
|
||||
#ifndef __cplusplus
|
||||
extern char *getenv(const char *);
|
||||
#endif
|
||||
#endif
|
||||
int
|
||||
defParserparse()
|
||||
{
|
||||
int defParserm, defParsern, defParserstate;
|
||||
#if defParserDEBUG
|
||||
char *defParsers;
|
||||
|
||||
if (defParsers = getenv("defParserDEBUG"))
|
||||
{
|
||||
defParsern = *defParsers;
|
||||
if (defParsern >= '0' && defParsern <= '9')
|
||||
defParserdebug = defParsern - '0';
|
||||
}
|
||||
#endif
|
||||
|
||||
defParsernerrs = 0;
|
||||
defParsererrflag = 0;
|
||||
defParserchar = (-1);
|
||||
|
||||
defParserssp = defParserss;
|
||||
defParservsp = defParservs;
|
||||
*defParserssp = defParserstate = 0;
|
||||
|
||||
defParserloop:
|
||||
if ((defParsern = defParserdefred[defParserstate])) goto defParserreduce;
|
||||
if (defParserchar < 0)
|
||||
{
|
||||
if ((defParserchar = defParserlex()) < 0) defParserchar = 0;
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
{
|
||||
defParsers = 0;
|
||||
if (defParserchar <= defParserMAXTOKEN) defParsers = defParsername[defParserchar];
|
||||
if (!defParsers) defParsers = "illegal-symbol";
|
||||
printf("defParserdebug: state %d, reading %d (%s)\n", defParserstate,
|
||||
defParserchar, defParsers);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if ((defParsern = defParsersindex[defParserstate]) && (defParsern += defParserchar) >= 0 &&
|
||||
defParsern <= defParserTABLESIZE && defParsercheck[defParsern] == defParserchar)
|
||||
{
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
printf("defParserdebug: state %d, shifting to state %d\n",
|
||||
defParserstate, defParsertable[defParsern]);
|
||||
#endif
|
||||
if (defParserssp >= defParserss + defParserstacksize - 1)
|
||||
{
|
||||
goto defParseroverflow;
|
||||
}
|
||||
*++defParserssp = defParserstate = defParsertable[defParsern];
|
||||
*++defParservsp = defParserlval;
|
||||
defParserchar = (-1);
|
||||
if (defParsererrflag > 0) --defParsererrflag;
|
||||
goto defParserloop;
|
||||
}
|
||||
if ((defParsern = defParserrindex[defParserstate]) && (defParsern += defParserchar) >= 0 &&
|
||||
defParsern <= defParserTABLESIZE && defParsercheck[defParsern] == defParserchar)
|
||||
{
|
||||
defParsern = defParsertable[defParsern];
|
||||
goto defParserreduce;
|
||||
}
|
||||
if (defParsererrflag) goto defParserinrecovery;
|
||||
// Disable for now
|
||||
#if 0
|
||||
#ifdef lint
|
||||
goto defParsernewerror;
|
||||
#endif
|
||||
defParsernewerror:
|
||||
#endif /* 0 */
|
||||
defParsererror((char*)"syntax error");
|
||||
// Disable for now
|
||||
#if 0
|
||||
#ifdef lint
|
||||
goto defParsererrlab;
|
||||
#endif
|
||||
defParsererrlab:
|
||||
#endif /* 0 */
|
||||
++defParsernerrs;
|
||||
defParserinrecovery:
|
||||
if (defParsererrflag < 3)
|
||||
{
|
||||
defParsererrflag = 3;
|
||||
for (;;)
|
||||
{
|
||||
if ((defParsern = defParsersindex[*defParserssp]) && (defParsern += defParserERRCODE) >= 0 &&
|
||||
defParsern <= defParserTABLESIZE && defParsercheck[defParsern] == defParserERRCODE)
|
||||
{
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
printf("defParserdebug: state %d, error recovery shifting\
|
||||
to state %d\n", *defParserssp, defParsertable[defParsern]);
|
||||
#endif
|
||||
if (defParserssp >= defParserss + defParserstacksize - 1)
|
||||
{
|
||||
goto defParseroverflow;
|
||||
}
|
||||
*++defParserssp = defParserstate = defParsertable[defParsern];
|
||||
*++defParservsp = defParserlval;
|
||||
goto defParserloop;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
printf("defParserdebug: error recovery discarding state %d\n",
|
||||
*defParserssp);
|
||||
#endif
|
||||
if (defParserssp <= defParserss) goto defParserabort;
|
||||
--defParserssp;
|
||||
--defParservsp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defParserchar == 0) goto defParserabort;
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
{
|
||||
defParsers = 0;
|
||||
if (defParserchar <= defParserMAXTOKEN) defParsers = defParsername[defParserchar];
|
||||
if (!defParsers) defParsers = "illegal-symbol";
|
||||
printf("defParserdebug: state %d, error recovery discards token %d (%s)\n",
|
||||
defParserstate, defParserchar, defParsers);
|
||||
}
|
||||
#endif
|
||||
defParserchar = (-1);
|
||||
goto defParserloop;
|
||||
}
|
||||
defParserreduce:
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
printf("defParserdebug: state %d, reducing by rule %d (%s)\n",
|
||||
defParserstate, defParsern, defParserrule[defParsern]);
|
||||
#endif
|
||||
defParserm = defParserlen[defParsern];
|
||||
defParserval = defParservsp[1-defParserm];
|
||||
switch (defParsern)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
g_def_list = defParservsp[0].defListPtrData;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
defParserval.defListPtrData=defParservsp[-1].defListPtrData;
|
||||
|
||||
if ( defParservsp[0].defPtrData -> type() == FeatureDef::WILDCARD )
|
||||
defParserval.defListPtrData -> prepend(defParservsp[0].defPtrData);
|
||||
else
|
||||
defParserval.defListPtrData -> append(defParservsp[0].defPtrData);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
defParserval.defListPtrData=new def_list_t();
|
||||
defParserval.defListPtrData -> append(defParservsp[0].defPtrData);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
defParserval.defPtrData=defParservsp[0].defPtrData;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
defParserval.defPtrData=defParservsp[0].defPtrData;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
defParserval.defPtrData=defParservsp[0].defPtrData;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
defParserval.defPtrData=defParservsp[0].defPtrData;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
defParserval.defPtrData= new FeatureDefComposite((char*)defParservsp[-3].charPtrData, defParservsp[-1].defListPtrData);
|
||||
delete defParservsp[-3].charPtrData;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
defParserval.defPtrData= new FeatureDefPrimitive((char*)defParservsp[-3].charPtrData, defParservsp[-1].typeValuesListPtrData);
|
||||
delete defParservsp[-3].charPtrData;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
defParserval.defPtrData= new FeatureDefReference((char*)defParservsp[-1].charPtrData);
|
||||
delete defParservsp[-1].charPtrData;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
defParserval.defPtrData= new FeatureDefWildCard("*");
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
defParserval.charPtrData=defParservsp[0].charPtrData;
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
defParserval.typeValuesListPtrData=defParservsp[-2].typeValuesListPtrData;
|
||||
defParserval.typeValuesListPtrData -> append(defParservsp[0].typeValuesPtrData);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
defParserval.typeValuesListPtrData=new type_values_list_t();
|
||||
defParserval.typeValuesListPtrData -> append(defParservsp[0].typeValuesPtrData);
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
defParserval.typeValuesPtrData=new TypeValues((char*)defParservsp[-3].charPtrData, defParservsp[-1].valueListPtrData);
|
||||
delete defParservsp[-3].charPtrData;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
defParserval.typeValuesPtrData=new TypeValues((char*)defParservsp[0].charPtrData, 0);
|
||||
delete defParservsp[0].charPtrData;
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
defParservsp[-2].valueListPtrData -> append(defParservsp[0].valueData);
|
||||
defParserval.valueListPtrData=defParservsp[-2].valueListPtrData;
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
{
|
||||
defParserval.valueListPtrData = new defv_t();
|
||||
defParserval.valueListPtrData -> append(defParservsp[0].valueData);
|
||||
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
{
|
||||
defParserval.valueData=new FeatureValueInt(defParservsp[0].intData);
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
{
|
||||
defParserval.valueData=new FeatureValueString((char*)defParservsp[0].charPtrData);
|
||||
delete defParservsp[0].charPtrData;
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
{
|
||||
defParserval.valueData=new FeatureValueReal(defParservsp[0].realData);
|
||||
}
|
||||
break;
|
||||
}
|
||||
defParserssp -= defParserm;
|
||||
defParserstate = *defParserssp;
|
||||
defParservsp -= defParserm;
|
||||
defParserm = defParserlhs[defParsern];
|
||||
if (defParserstate == 0 && defParserm == 0)
|
||||
{
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
printf("defParserdebug: after reduction, shifting from state 0 to\
|
||||
state %d\n", defParserFINAL);
|
||||
#endif
|
||||
defParserstate = defParserFINAL;
|
||||
*++defParserssp = defParserFINAL;
|
||||
*++defParservsp = defParserval;
|
||||
if (defParserchar < 0)
|
||||
{
|
||||
if ((defParserchar = defParserlex()) < 0) defParserchar = 0;
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
{
|
||||
defParsers = 0;
|
||||
if (defParserchar <= defParserMAXTOKEN) defParsers = defParsername[defParserchar];
|
||||
if (!defParsers) defParsers = "illegal-symbol";
|
||||
printf("defParserdebug: state %d, reading %d (%s)\n",
|
||||
defParserFINAL, defParserchar, defParsers);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (defParserchar == 0) goto defParseraccept;
|
||||
goto defParserloop;
|
||||
}
|
||||
if ((defParsern = defParsergindex[defParserm]) && (defParsern += defParserstate) >= 0 &&
|
||||
defParsern <= defParserTABLESIZE && defParsercheck[defParsern] == defParserstate)
|
||||
defParserstate = defParsertable[defParsern];
|
||||
else
|
||||
defParserstate = defParserdgoto[defParserm];
|
||||
#if defParserDEBUG
|
||||
if (defParserdebug)
|
||||
printf("defParserdebug: after reduction, shifting from state %d \
|
||||
to state %d\n", *defParserssp, defParserstate);
|
||||
#endif
|
||||
if (defParserssp >= defParserss + defParserstacksize - 1)
|
||||
{
|
||||
goto defParseroverflow;
|
||||
}
|
||||
*++defParserssp = defParserstate;
|
||||
*++defParservsp = defParserval;
|
||||
goto defParserloop;
|
||||
defParseroverflow:
|
||||
defParsererror((char*)"yacc stack overflow");
|
||||
defParserabort:
|
||||
return (1);
|
||||
defParseraccept:
|
||||
return (0);
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these libraries and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/* $XConsortium: defParser.tab.h /main/3 1996/06/11 17:46:23 cde-hal $ */
|
||||
#define STAR 257
|
||||
#define COMMA 258
|
||||
#define COLON 259
|
||||
#define SEMI_COLON 260
|
||||
#define FSOPEN 261
|
||||
#define FSCLOSE 262
|
||||
#define OPER_parenopen 263
|
||||
#define OPER_parenclose 264
|
||||
#define INTEGER 265
|
||||
#define REAL 266
|
||||
#define NORMAL_STRING 267
|
||||
#define QUOTED_STRING 268
|
||||
#define REF_NAME 269
|
||||
#define TYPE 270
|
||||
#define ValueListOpt 271
|
||||
typedef union
|
||||
{
|
||||
unsigned char charData;
|
||||
unsigned char* charPtrData;
|
||||
int intData;
|
||||
float realData;
|
||||
FeatureValue* valueData;
|
||||
|
||||
defv_t* valueListPtrData;
|
||||
TypeValues* typeValuesPtrData;
|
||||
type_values_list_t* typeValuesListPtrData;
|
||||
|
||||
def_list_t* defListPtrData;
|
||||
FeatureDef* defPtrData;
|
||||
|
||||
} YYSTYPE;
|
||||
extern YYSTYPE defParserlval;
|
|
@ -4,7 +4,7 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sstream>
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
#include "Debug.h"
|
||||
#include "FeatureDefDictionary.h"
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,4 @@
|
|||
%option noyywrap
|
||||
|
||||
%a 30000
|
||||
%e 10000
|
||||
|
@ -16,21 +17,19 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
extern istream *g_yyin;
|
||||
extern istream *g_defParserin;
|
||||
|
||||
#define YY_INPUT(buf,result,max_size)\
|
||||
{\
|
||||
if (g_yyin -> eof()) {\
|
||||
if (g_defParserin -> eof()) {\
|
||||
result=0;\
|
||||
} else {\
|
||||
g_yyin -> read((char *)buf, max_size-1); \
|
||||
result = g_yyin -> gcount(); \
|
||||
g_defParserin -> read((char *)buf, max_size-1); \
|
||||
result = g_defParserin -> gcount(); \
|
||||
buf[result] = 0; \
|
||||
}\
|
||||
}
|
||||
|
||||
int yylineno=1;
|
||||
|
||||
unsigned char* defToken_string_buf = new unsigned char[1024];
|
||||
int defToken_string_buf_size = 1024;
|
||||
int defToken_string_buf_content_size = 0;
|
||||
|
@ -43,7 +42,7 @@ unsigned char* new_copy(const unsigned char* str, int size)
|
|||
return x;
|
||||
}
|
||||
|
||||
void addToDefTokenStringBuf(const unsigned char* str, int size)
|
||||
void addToDefTokenStringBuf(const char* str, int size)
|
||||
{
|
||||
if ( size <= 0 ) return;
|
||||
|
||||
|
@ -113,53 +112,53 @@ boolean ([Bb][Oo][Oo][Ll][Ee][Aa][Nn])
|
|||
|
||||
|
||||
{stringprefix} {
|
||||
yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
return(TYPE);
|
||||
}
|
||||
|
||||
{string} {
|
||||
yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
return(TYPE);
|
||||
}
|
||||
|
||||
{integer} {
|
||||
yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
return(TYPE);
|
||||
}
|
||||
|
||||
{real} {
|
||||
yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
return(TYPE);
|
||||
}
|
||||
|
||||
{unit} {
|
||||
yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
return(TYPE);
|
||||
}
|
||||
|
||||
{unitpixel} {
|
||||
yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
return(TYPE);
|
||||
}
|
||||
|
||||
{array} {
|
||||
yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng);
|
||||
return(TYPE);
|
||||
}
|
||||
|
||||
{boolean} {
|
||||
yylval.charPtrData =
|
||||
defParserlval.charPtrData =
|
||||
new_copy((unsigned char*)"INTEGER", strlen("INTEGER"));
|
||||
return(TYPE);
|
||||
}
|
||||
|
||||
[0-9]+ {
|
||||
yylval.intData = atoi((char*)yytext);
|
||||
defParserlval.intData = atoi((char*)yytext);
|
||||
return(INTEGER);
|
||||
}
|
||||
|
||||
[0-9]+"."[0-9]+ {
|
||||
yylval.realData = atof((char*)yytext);
|
||||
defParserlval.realData = atof((char*)yytext);
|
||||
return(REAL);
|
||||
}
|
||||
|
||||
|
@ -169,10 +168,10 @@ boolean ([Bb][Oo][Oo][Ll][Ee][Aa][Nn])
|
|||
|
||||
<quoted_string>\" {
|
||||
|
||||
yylval.charPtrData =
|
||||
defParserlval.charPtrData =
|
||||
new unsigned char[defToken_string_buf_content_size+1];
|
||||
memcpy( yylval.charPtrData,
|
||||
defToken_string_buf,
|
||||
memcpy( defParserlval.charPtrData,
|
||||
defToken_string_buf,
|
||||
defToken_string_buf_content_size+1
|
||||
);
|
||||
|
||||
|
@ -187,13 +186,13 @@ boolean ([Bb][Oo][Oo][Ll][Ee][Aa][Nn])
|
|||
}
|
||||
|
||||
"&"[^ \t\n\";.=@+*\/\.\*:?\^,{}\[\]()]+ {
|
||||
yylval.charPtrData =
|
||||
defParserlval.charPtrData =
|
||||
(unsigned char*)strdup((const char*)(yytext+1));
|
||||
return(REF_NAME);
|
||||
}
|
||||
|
||||
[^ \t\n\";.=@+*\/\.\*:?\^,{}\[\]()]+ {
|
||||
yylval.charPtrData =
|
||||
defParserlval.charPtrData =
|
||||
(unsigned char*)strdup((const char*)yytext);
|
||||
return(NORMAL_STRING);
|
||||
}
|
||||
|
@ -212,7 +211,7 @@ boolean ([Bb][Oo][Oo][Ll][Ee][Aa][Nn])
|
|||
|
||||
%%
|
||||
|
||||
void yyerror(char* msg)
|
||||
void defParsererror(char* msg)
|
||||
{
|
||||
cerr << "line " << yylineno << ": " << msg;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these libraries and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/* $XConsortium: style.tab.h /main/3 1996/06/11 17:46:36 cde-hal $ */
|
||||
#define INTEGER 257
|
||||
#define OPER_equality 258
|
||||
#define OPER_relational 259
|
||||
#define BOOLVAL 260
|
||||
#define REAL 261
|
||||
#define OPER_assign 262
|
||||
#define ARRAYOPEN 263
|
||||
#define ARRAYCLOSE 264
|
||||
#define SEPARATOR 265
|
||||
#define FSOPEN 266
|
||||
#define FSCLOSE 267
|
||||
#define OPER_modify 268
|
||||
#define OPER_parent 269
|
||||
#define OPER_attr 270
|
||||
#define OPER_oneof 271
|
||||
#define OPER_star 272
|
||||
#define OPER_or 273
|
||||
#define OPER_and 274
|
||||
#define OPER_div 275
|
||||
#define OPER_parenopen 276
|
||||
#define OPER_parenclose 277
|
||||
#define OPER_logicalnegate 278
|
||||
#define PMEMOPEN 279
|
||||
#define PMEMCLOSE 280
|
||||
#define OPER_period 281
|
||||
#define OPER_plus 282
|
||||
#define OPER_minus 283
|
||||
#define DIMENSION 284
|
||||
#define NORMAL_STRING 285
|
||||
#define UNIT_STRING 286
|
||||
#define QUOTED_STRING 287
|
||||
#define GI_CASE_SENSITIVE 288
|
||||
#define SGMLGI_STRING 289
|
||||
typedef union
|
||||
{
|
||||
unsigned char charData;
|
||||
unsigned char* charPtrData;
|
||||
unsigned int boolData;
|
||||
int intData;
|
||||
float realData;
|
||||
Expression* expPtrData;
|
||||
TermNode* termNodePtrData;
|
||||
FeatureValue* FeatureValuePtrData;
|
||||
FeatureSet* FeatureSetPtrData;
|
||||
Feature* FeaturePtrData;
|
||||
SSPath* PathPtrData;
|
||||
PathTerm* PathTermPtrData;
|
||||
charPtrDlist* charPtrDlistData;
|
||||
PathFeatureList* PathFeatureListPtrData;
|
||||
CompositeVariableNode* CompositeVariableNodePtrData;
|
||||
|
||||
CC_TPtrSlist<FeatureValue>* FeatureValueSlistPtrData;
|
||||
|
||||
PQExpr* PQExprPtrData;
|
||||
} YYSTYPE;
|
||||
extern YYSTYPE stylelval;
|
|
@ -4,7 +4,7 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sstream>
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
#include "StyleSheetExceptions.h"
|
||||
#include "VariableTable.h"
|
File diff suppressed because it is too large
Load diff
|
@ -6,13 +6,13 @@
|
|||
* the Copyright Laws of the United States. USE OF A COPYRIGHT
|
||||
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
|
||||
* OR DISCLOSURE.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
|
||||
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
|
||||
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
|
||||
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
|
||||
* INTERNATIONAL, LTD.
|
||||
*
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND
|
||||
* Use, duplication, or disclosure by the Government is subject
|
||||
* to the restrictions as set forth in subparagraph (c)(l)(ii)
|
||||
|
@ -22,9 +22,10 @@
|
|||
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
|
||||
* 1315 Dell Avenue
|
||||
* Campbell, CA 95008
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
%option noyywrap
|
||||
|
||||
%a 30000
|
||||
%e 10000
|
||||
|
@ -44,9 +45,9 @@
|
|||
#include "StyleSheetExceptions.h"
|
||||
#include "style.tab.h"
|
||||
#include "Debug.h"
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
|
||||
extern istream *g_stylein ;
|
||||
istream *g_stylein = 0;
|
||||
|
||||
#define YY_INPUT(buf,result,max_size)\
|
||||
{\
|
||||
|
@ -67,8 +68,6 @@ char* commentBuffer = new char [1024];
|
|||
int commentBufferSize = 1024;
|
||||
int commentBufferContentSize = 0;
|
||||
|
||||
int yylineno=1;
|
||||
|
||||
void addToQstringBuf(const unsigned char* str, int size)
|
||||
{
|
||||
if ( size <= 0 ) return;
|
||||
|
@ -101,7 +100,7 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
delete [] commentBuffer;
|
||||
commentBufferSize = 2 * yyleng ;
|
||||
commentBuffer = new char [commentBufferSize];
|
||||
}
|
||||
}
|
||||
|
||||
commentBufferContentSize = yyleng-1;
|
||||
memcpy(commentBuffer, yytext+1, commentBufferContentSize); // copy everything except the #
|
||||
|
@ -117,17 +116,17 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
}
|
||||
|
||||
[+] {
|
||||
yylval.charData = yytext[0];
|
||||
stylelval.charData = yytext[0];
|
||||
return(OPER_plus);
|
||||
}
|
||||
|
||||
[-] {
|
||||
yylval.charData = yytext[0];
|
||||
stylelval.charData = yytext[0];
|
||||
return(OPER_minus);
|
||||
}
|
||||
|
||||
"/" {
|
||||
yylval.charData = yytext[0];
|
||||
stylelval.charData = yytext[0];
|
||||
return(OPER_div);
|
||||
}
|
||||
|
||||
|
@ -136,7 +135,7 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
}
|
||||
|
||||
"*" {
|
||||
yylval.charData = yytext[0];
|
||||
stylelval.charData = yytext[0];
|
||||
return(OPER_star);
|
||||
}
|
||||
|
||||
|
@ -190,9 +189,9 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
|
||||
"=="|"!=" {
|
||||
if ( strcmp((const char*)yytext, "==") == 0 )
|
||||
yylval.intData = EQUAL;
|
||||
stylelval.intData = EQUAL;
|
||||
else
|
||||
yylval.intData = NOT_EQUAL;
|
||||
stylelval.intData = NOT_EQUAL;
|
||||
|
||||
return(OPER_equality);
|
||||
}
|
||||
|
@ -203,15 +202,15 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
|
||||
"<="|"<"|">="|">" {
|
||||
if ( strcmp((const char*)yytext, "<=") == 0 )
|
||||
yylval.intData = LESS_OR_EQUAL;
|
||||
stylelval.intData = LESS_OR_EQUAL;
|
||||
else
|
||||
if ( strcmp((const char*)yytext, "<") == 0 )
|
||||
yylval.intData = LESS;
|
||||
stylelval.intData = LESS;
|
||||
else
|
||||
if ( strcmp((const char*)yytext, ">=") == 0 )
|
||||
yylval.intData = GREATER_OR_EQUAL;
|
||||
stylelval.intData = GREATER_OR_EQUAL;
|
||||
else
|
||||
yylval.intData = GREATER;
|
||||
stylelval.intData = GREATER;
|
||||
|
||||
return(OPER_relational);
|
||||
}
|
||||
|
@ -221,38 +220,38 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
}
|
||||
|
||||
[Tt][Rr][Uu][Ee] {
|
||||
yylval.boolData = true;
|
||||
stylelval.boolData = true;
|
||||
return(BOOLVAL);
|
||||
}
|
||||
|
||||
[Ff][Aa][Ll][Ss][Ee] {
|
||||
yylval.boolData = false;
|
||||
stylelval.boolData = false;
|
||||
return(BOOLVAL);
|
||||
}
|
||||
|
||||
[On][Nn] {
|
||||
yylval.boolData = true;
|
||||
stylelval.boolData = true;
|
||||
return(BOOLVAL);
|
||||
}
|
||||
|
||||
[Oo][Ff][Ff] {
|
||||
yylval.boolData = false;
|
||||
stylelval.boolData = false;
|
||||
return(BOOLVAL);
|
||||
}
|
||||
|
||||
[0-9]+("."[0-9]+)?{unit} {
|
||||
yylval.charPtrData =
|
||||
stylelval.charPtrData =
|
||||
(unsigned char*)strdup((const char*)yytext);
|
||||
return(DIMENSION);
|
||||
}
|
||||
|
||||
[0-9]+ {
|
||||
yylval.intData = atoi((char*)yytext);
|
||||
stylelval.intData = atoi((char*)yytext);
|
||||
return(INTEGER);
|
||||
}
|
||||
|
||||
[0-9]+"."[0-9]+ {
|
||||
yylval.realData = atof((char*)yytext);
|
||||
stylelval.realData = atof((char*)yytext);
|
||||
return(REAL);
|
||||
}
|
||||
|
||||
|
@ -262,10 +261,10 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
|
||||
<quoted_string>\" {
|
||||
|
||||
yylval.charPtrData =
|
||||
stylelval.charPtrData =
|
||||
new unsigned char[qstring_buf_content_size+1];
|
||||
memcpy( yylval.charPtrData,
|
||||
qstring_buf,
|
||||
memcpy( stylelval.charPtrData,
|
||||
qstring_buf,
|
||||
qstring_buf_content_size+1
|
||||
);
|
||||
|
||||
|
@ -276,7 +275,7 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
}
|
||||
|
||||
<quoted_string>\\ {
|
||||
int c = styleinput();
|
||||
int c = yyinput();
|
||||
switch (c) {
|
||||
case '"':
|
||||
addToQstringBuf((unsigned char*)"\"", 1);
|
||||
|
@ -298,19 +297,19 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][
|
|||
}
|
||||
|
||||
{unit} {
|
||||
yylval.charPtrData =
|
||||
stylelval.charPtrData =
|
||||
(unsigned char*)strdup((const char*)yytext);
|
||||
return(UNIT_STRING);
|
||||
}
|
||||
|
||||
[^ \t\n\".=@+*\/\.\*:?\^,{}\[\]()!]+ {
|
||||
yylval.charPtrData =
|
||||
stylelval.charPtrData =
|
||||
(unsigned char*)strdup((const char*)yytext);
|
||||
return(NORMAL_STRING);
|
||||
}
|
||||
|
||||
<sgmlgimode>[0-9a-zA-Z\.\-]+ {
|
||||
yylval.charPtrData =
|
||||
stylelval.charPtrData =
|
||||
(unsigned char*)strdup((const char*)yytext);
|
||||
BEGIN 0;
|
||||
return(SGMLGI_STRING);
|
||||
|
@ -346,7 +345,7 @@ void report_error_location()
|
|||
}
|
||||
}
|
||||
|
||||
void yyerror(char* msg)
|
||||
void styleerror(char* msg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
cerr << "line " << yylineno << ": " << msg << "\n";
|
Loading…
Reference in a new issue