1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

dtinfogen: repair lex and yacc source.

This commit is contained in:
Liang Chang 2021-11-30 02:33:46 +08:00
parent 00c5ba3508
commit bcdd71df8c
13 changed files with 42 additions and 15089 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,23 +1,28 @@
%option noyywrap
%{
/* $XConsortium: ContentType.l /main/2 1996/11/19 16:54:22 drk $ */
#include <iostream.h>
#include <stream.h>
#include <iostream>
#include <sstream>
using namespace std;
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <assert.h>
#include "Exceptions.hh"
#include "Task.h"
#include "SGMLName.h"
#include "Task.h"
#include "SGMLName.h"
#include "ExprList.h"
#include "Expression.h"
#include "OL_DataExpr.tab.h"
#include "ContentType.h"
#include "api/utility.h"
/* CurrentContentPtr is used as the communication media between
* yyparse and ContentType::Parse()
*/
@ -140,7 +145,7 @@ my_input ( char *buf, int max_size )
//--------------------------------------------------------------
void
ol_dataerror(char *str)
ol_dataerror(const char *str)
{
throw(Unexpected(form("Syntax error in %s", myinput)));
}
@ -158,9 +163,9 @@ ContentType::ContentType()
ContentType::~ContentType()
{
Expression *eptr = exprlist;
OL_Expression *eptr = exprlist;
while ( eptr ) {
Expression *tmp = eptr;
OL_Expression *tmp = eptr;
eptr = eptr->next;
delete tmp;
}
@ -187,7 +192,7 @@ ContentType::Parse( char *str )
//--------------------------------------------------------------
void
ContentType::init( Expression *expr )
ContentType::init( OL_Expression *expr )
{
assert(expr);
if ( expr->next ) {
@ -196,7 +201,7 @@ ContentType::init( Expression *expr )
* The same as CONCAT
*/
ExprList *elist = new ExprList( expr );
Expression *new_expr = new Expression ( CONCAT, -1, elist );
OL_Expression *new_expr = new OL_Expression ( CONCAT, -1, elist );
assert(new_expr);
exprlist = new_expr;
@ -205,4 +210,3 @@ ContentType::init( Expression *expr )
exprlist = expr;
}
}

View file

@ -1,435 +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: OL_DataExpr.C /main/4 1997/12/23 11:38:27 bill $ */
#ifndef lint
__attribute__((unused))
static const char ol_datasccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
#endif
#define ol_dataBYACC 1
#line 2 "OL_DataExpr.y"
#include <stdio.h>
#include "ExprList.h"
#include "Expression.h"
#include "ContentType.h"
extern int ol_datalex();
extern void ol_dataerror( char *str );
extern ContentType *CurrentContentPtr;
#line 14 "OL_DataExpr.y"
typedef union {
int name;
char *string;
OL_Expression *eptr;
} ol_dataSTYPE;
#line 23 "y.tab.c"
#define Reference 257
#define Id 258
#define Literal 259
#define Content 260
#define Concat 261
#define Attr 262
#define FirstOf 263
#define ol_dataERRCODE 256
short ol_datalhs[] = { -1,
0, 2, 2, 1, 1, 1, 1, 1, 1, 1,
};
short ol_datalen[] = { 2,
1, 1, 3, 1, 1, 4, 4, 4, 1, 1,
};
short ol_datadefred[] = { 0,
10, 4, 9, 5, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 3, 6, 7,
8,
};
short ol_datadgoto[] = { 8,
9, 10,
};
short ol_datasindex[] = { -255,
0, 0, 0, 0, -40, -30, -27, 0, -29, 0,
-255, -244, -255, -255, -25, -24, -23, 0, 0, 0,
0,
};
short ol_datarindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
};
short ol_datagindex[] = { 0,
0, -2,
};
#define ol_dataTABLESIZE 42
short ol_datatable[] = { 11,
2, 1, 2, 3, 4, 5, 6, 7, 15, 12,
17, 18, 13, 16, 14, 19, 20, 21, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2,
};
short ol_datacheck[] = { 40,
0, 257, 258, 259, 260, 261, 262, 263, 11, 40,
13, 14, 40, 258, 44, 41, 41, 41, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 41,
};
#define ol_dataFINAL 8
#ifndef ol_dataDEBUG
#define ol_dataDEBUG 0
#endif
#define ol_dataMAXTOKEN 263
#if ol_dataDEBUG
char *ol_dataname[] = {
"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,"Reference","Id",
"Literal","Content","Concat","Attr","FirstOf",
};
char *ol_datarule[] = {
"$accept : ValList",
"ValList : ExprList",
"ExprList : Expr",
"ExprList : Expr ',' ExprList",
"Expr : Id",
"Expr : Content",
"Expr : Concat '(' ExprList ')'",
"Expr : Attr '(' Id ')'",
"Expr : FirstOf '(' ExprList ')'",
"Expr : Literal",
"Expr : Reference",
};
#endif
#define ol_dataclearin (ol_datachar=(-1))
#define ol_dataerrok (ol_dataerrflag=0)
#ifdef ol_dataSTACKSIZE
#ifndef ol_dataMAXDEPTH
#define ol_dataMAXDEPTH ol_dataSTACKSIZE
#endif
#else
#ifdef ol_dataMAXDEPTH
#define ol_dataSTACKSIZE ol_dataMAXDEPTH
#else
#define ol_dataSTACKSIZE 500
#define ol_dataMAXDEPTH 500
#endif
#endif
int ol_datadebug;
int ol_datanerrs;
int ol_dataerrflag;
int ol_datachar;
short *ol_datassp;
ol_dataSTYPE *ol_datavsp;
ol_dataSTYPE ol_dataval;
ol_dataSTYPE ol_datalval;
short ol_datass[ol_dataSTACKSIZE];
ol_dataSTYPE ol_datavs[ol_dataSTACKSIZE];
#define ol_datastacksize ol_dataSTACKSIZE
#line 97 "OL_DataExpr.y"
#line 136 "y.tab.c"
#define ol_dataABORT goto ol_dataabort
#define ol_dataACCEPT goto ol_dataaccept
#define ol_dataERROR goto ol_dataerrlab
#if ol_dataDEBUG
#ifndef __cplusplus
extern char *getenv(const char *);
#endif
#endif
int
ol_dataparse()
{
int ol_datam, ol_datan, ol_datastate;
#if ol_dataDEBUG
char *ol_datas;
if ((ol_datas = getenv("ol_dataDEBUG")))
{
ol_datan = *ol_datas;
if (ol_datan >= '0' && ol_datan <= '9')
ol_datadebug = ol_datan - '0';
}
#endif
ol_datanerrs = 0;
ol_dataerrflag = 0;
ol_datachar = (-1);
ol_datassp = ol_datass;
ol_datavsp = ol_datavs;
*ol_datassp = ol_datastate = 0;
ol_dataloop:
if ((ol_datan = ol_datadefred[ol_datastate])) goto ol_datareduce;
if (ol_datachar < 0)
{
if ((ol_datachar = ol_datalex()) < 0) ol_datachar = 0;
#if ol_dataDEBUG
if (ol_datadebug)
{
ol_datas = 0;
if (ol_datachar <= ol_dataMAXTOKEN) ol_datas = ol_dataname[ol_datachar];
if (!ol_datas) ol_datas = "illegal-symbol";
printf("ol_datadebug: state %d, reading %d (%s)\n", ol_datastate,
ol_datachar, ol_datas);
}
#endif
}
if ((ol_datan = ol_datasindex[ol_datastate]) && (ol_datan += ol_datachar) >= 0 &&
ol_datan <= ol_dataTABLESIZE && ol_datacheck[ol_datan] == ol_datachar)
{
#if ol_dataDEBUG
if (ol_datadebug)
printf("ol_datadebug: state %d, shifting to state %d\n",
ol_datastate, ol_datatable[ol_datan]);
#endif
if (ol_datassp >= ol_datass + ol_datastacksize - 1)
{
goto ol_dataoverflow;
}
*++ol_datassp = ol_datastate = ol_datatable[ol_datan];
*++ol_datavsp = ol_datalval;
ol_datachar = (-1);
if (ol_dataerrflag > 0) --ol_dataerrflag;
goto ol_dataloop;
}
if ((ol_datan = ol_datarindex[ol_datastate]) && (ol_datan += ol_datachar) >= 0 &&
ol_datan <= ol_dataTABLESIZE && ol_datacheck[ol_datan] == ol_datachar)
{
ol_datan = ol_datatable[ol_datan];
goto ol_datareduce;
}
if (ol_dataerrflag) goto ol_datainrecovery;
// Disable for now
#if 0
#ifdef lint
goto ol_datanewerror;
#endif
ol_datanewerror:
#endif /* 0 */
ol_dataerror((char*)"syntax error");
// Disable for now
#if 0
#ifdef lint
goto ol_dataerrlab;
#endif
ol_dataerrlab:
#endif /* 0 */
++ol_datanerrs;
ol_datainrecovery:
if (ol_dataerrflag < 3)
{
ol_dataerrflag = 3;
for (;;)
{
if ((ol_datan = ol_datasindex[*ol_datassp]) && (ol_datan += ol_dataERRCODE) >= 0 &&
ol_datan <= ol_dataTABLESIZE && ol_datacheck[ol_datan] == ol_dataERRCODE)
{
#if ol_dataDEBUG
if (ol_datadebug)
printf("ol_datadebug: state %d, error recovery shifting\
to state %d\n", *ol_datassp, ol_datatable[ol_datan]);
#endif
if (ol_datassp >= ol_datass + ol_datastacksize - 1)
{
goto ol_dataoverflow;
}
*++ol_datassp = ol_datastate = ol_datatable[ol_datan];
*++ol_datavsp = ol_datalval;
goto ol_dataloop;
}
else
{
#if ol_dataDEBUG
if (ol_datadebug)
printf("ol_datadebug: error recovery discarding state %d\n",
*ol_datassp);
#endif
if (ol_datassp <= ol_datass) goto ol_dataabort;
--ol_datassp;
--ol_datavsp;
}
}
}
else
{
if (ol_datachar == 0) goto ol_dataabort;
#if ol_dataDEBUG
if (ol_datadebug)
{
ol_datas = 0;
if (ol_datachar <= ol_dataMAXTOKEN) ol_datas = ol_dataname[ol_datachar];
if (!ol_datas) ol_datas = "illegal-symbol";
printf("ol_datadebug: state %d, error recovery discards token %d (%s)\n",
ol_datastate, ol_datachar, ol_datas);
}
#endif
ol_datachar = (-1);
goto ol_dataloop;
}
ol_datareduce:
#if ol_dataDEBUG
if (ol_datadebug)
printf("ol_datadebug: state %d, reducing by rule %d (%s)\n",
ol_datastate, ol_datan, ol_datarule[ol_datan]);
#endif
ol_datam = ol_datalen[ol_datan];
ol_dataval = ol_datavsp[1-ol_datam];
switch (ol_datan)
{
case 1:
#line 36 "OL_DataExpr.y"
{
CurrentContentPtr->init(ol_datavsp[0].eptr);
}
break;
case 2:
#line 42 "OL_DataExpr.y"
{
ol_dataval.eptr = ol_datavsp[0].eptr;
}
break;
case 3:
#line 46 "OL_DataExpr.y"
{
ol_datavsp[-2].eptr->next = ol_datavsp[0].eptr;
ol_dataval.eptr = ol_datavsp[-2].eptr;
}
break;
case 4:
#line 53 "OL_DataExpr.y"
{
OL_Expression *expr = new OL_Expression( GENERIC_ID, ol_datavsp[0].name);
ol_dataval.eptr = expr;
}
break;
case 5:
#line 59 "OL_DataExpr.y"
{
OL_Expression *expr = new OL_Expression( CONTENT );
ol_dataval.eptr = expr;
}
break;
case 6:
#line 65 "OL_DataExpr.y"
{
ExprList *elist = new ExprList( ol_datavsp[-1].eptr );
OL_Expression *expr = new OL_Expression( CONCAT, -1, elist);
ol_dataval.eptr = expr;
}
break;
case 7:
#line 71 "OL_DataExpr.y"
{
OL_Expression *expr = new OL_Expression( REFERENCE, ol_datavsp[-1].name);
ol_dataval.eptr = expr;
}
break;
case 8:
#line 76 "OL_DataExpr.y"
{
ExprList *elist = new ExprList ( ol_datavsp[-1].eptr );
OL_Expression *expr = new OL_Expression( FIRSTOF, -1, elist );
ol_dataval.eptr = expr;
}
break;
case 9:
#line 83 "OL_DataExpr.y"
{
OL_Expression *expr = new OL_Expression( LITERAL, -1, ol_datavsp[0].string );
ol_dataval.eptr = expr;
}
break;
case 10:
#line 89 "OL_DataExpr.y"
{
OL_Expression *expr = new OL_Expression( REFERENCE, ol_datavsp[0].name );
ol_dataval.eptr = expr;
}
break;
#line 350 "y.tab.c"
}
ol_datassp -= ol_datam;
ol_datastate = *ol_datassp;
ol_datavsp -= ol_datam;
ol_datam = ol_datalhs[ol_datan];
if (ol_datastate == 0 && ol_datam == 0)
{
#if ol_dataDEBUG
if (ol_datadebug)
printf("ol_datadebug: after reduction, shifting from state 0 to\
state %d\n", ol_dataFINAL);
#endif
ol_datastate = ol_dataFINAL;
*++ol_datassp = ol_dataFINAL;
*++ol_datavsp = ol_dataval;
if (ol_datachar < 0)
{
if ((ol_datachar = ol_datalex()) < 0) ol_datachar = 0;
#if ol_dataDEBUG
if (ol_datadebug)
{
ol_datas = 0;
if (ol_datachar <= ol_dataMAXTOKEN) ol_datas = ol_dataname[ol_datachar];
if (!ol_datas) ol_datas = "illegal-symbol";
printf("ol_datadebug: state %d, reading %d (%s)\n",
ol_dataFINAL, ol_datachar, ol_datas);
}
#endif
}
if (ol_datachar == 0) goto ol_dataaccept;
goto ol_dataloop;
}
if ((ol_datan = ol_datagindex[ol_datam]) && (ol_datan += ol_datastate) >= 0 &&
ol_datan <= ol_dataTABLESIZE && ol_datacheck[ol_datan] == ol_datastate)
ol_datastate = ol_datatable[ol_datan];
else
ol_datastate = ol_datadgoto[ol_datam];
#if ol_dataDEBUG
if (ol_datadebug)
printf("ol_datadebug: after reduction, shifting from state %d \
to state %d\n", *ol_datassp, ol_datastate);
#endif
if (ol_datassp >= ol_datass + ol_datastacksize - 1)
{
goto ol_dataoverflow;
}
*++ol_datassp = ol_datastate;
*++ol_datavsp = ol_dataval;
goto ol_dataloop;
ol_dataoverflow:
ol_dataerror((char*)"yacc stack overflow");
ol_dataabort:
return (1);
ol_dataaccept:
return (0);
}

View file

@ -1,36 +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: OL_DataExpr.tab.h /main/3 1996/08/21 15:57:56 drk $ */
#define Reference 257
#define Id 258
#define Literal 259
#define Content 260
#define Concat 261
#define Attr 262
#define FirstOf 263
typedef union {
int name;
char *string;
OL_Expression *eptr;
} YYSTYPE;
extern YYSTYPE ol_datalval;

View file

@ -6,7 +6,7 @@
#include "ContentType.h"
extern int yylex();
extern void yyerror( char *str );
extern void yyerror( const char *str );
extern ContentType *CurrentContentPtr;
@ -15,7 +15,7 @@ extern ContentType *CurrentContentPtr;
%union {
int name;
char *string;
Expression *eptr;
OL_Expression *eptr;
}
%token <name> Reference
@ -52,43 +52,43 @@ ExprList : Expr
Expr : Id
{
Expression *expr = new Expression( GENERIC_ID, $1);
OL_Expression *expr = new OL_Expression( GENERIC_ID, $1);
$$ = expr;
}
| Content
{
Expression *expr = new Expression( CONTENT );
OL_Expression *expr = new OL_Expression( CONTENT );
$$ = expr;
}
| Concat '(' ExprList ')'
{
ExprList *elist = new ExprList( $3 );
Expression *expr = new Expression( CONCAT, -1, elist);
OL_Expression *expr = new OL_Expression( CONCAT, -1, elist);
$$ = expr;
}
| Attr '(' Id ')'
{
Expression *expr = new Expression( REFERENCE, $3);
OL_Expression *expr = new OL_Expression( REFERENCE, $3);
$$ = expr;
}
| FirstOf '(' ExprList ')'
{
ExprList *elist = new ExprList ( $3 );
Expression *expr = new Expression( FIRSTOF, -1, elist );
OL_Expression *expr = new OL_Expression( FIRSTOF, -1, elist );
$$ = expr;
}
| Literal
{
Expression *expr = new Expression( LITERAL, -1, $1 );
OL_Expression *expr = new OL_Expression( LITERAL, -1, $1 );
$$ = expr;
}
| Reference
{
Expression *expr = new Expression( REFERENCE, $1 );
OL_Expression *expr = new OL_Expression( REFERENCE, $1 );
$$ = expr;
}

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,5 @@
%option noyywrap
%{
/* $XConsortium: RemoteId.l /main/3 1996/11/19 16:54:33 drk $ */

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,5 @@
%option noyywrap
%{ /* -*- c++ -*- */
/* $XConsortium: ReplaceIdIdref.l /main/3 1996/11/19 16:54:45 drk $ */
@ -5,8 +7,8 @@
#include "NodeData.h"
/* imported interfaces... */
#include <iostream.h>
#include <stream.h>
#include <iostream>
#include <sstream>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
@ -23,7 +25,8 @@
#include "DataBase.h"
#include "BookCaseDB.h"
#include "GraphicsTask.h"
#include "Dispatch.h"
#include "Dispatch.h"
#include "api/utility.h"
// Debugging macro
#ifdef DEBUG

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,10 @@
%option noyywrap
%{
/* $XConsortium: gr_type.l /main/3 1996/11/19 16:55:02 drk $ */
#include <assert.h>
#include <stream.h>
#include <sstream>
#ifdef DEBUG
#include "oliasdb/olias_consts.h"

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,5 @@
%option noyywrap
%{ /* -*- c++ -*- */
/* $XConsortium: lex.l /main/5 1996/11/19 16:55:12 drk $ */
@ -7,14 +9,14 @@
#include <unistd.h>
#endif
#include <iostream.h>
#include <iostream>
#include <stdio.h>
#include <stream.h>
#include <sstream>
#include <string.h>
#include "Exceptions.hh"
#include "SGMLDefn.h"
#include "SGMLDefn.h"
#include "Dispatch.h"
#include "AttributeRec.h"
#include "AttributeList.h"
@ -57,7 +59,7 @@ unsigned char oct2dec( const char *str )
^A[^\n]+ {
char *name;
char *tstr;
char *value;
const char *value;
int type;
// Parse the attStr