Skip to content

Commit

Permalink
Adjust lex and grammar files
Browse files Browse the repository at this point in the history
  • Loading branch information
olebole committed Jan 12, 2024
1 parent dca83a1 commit fff7284
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
17 changes: 6 additions & 11 deletions obm/ObmW/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OBJS = Arrow.o Board.o Button.o Common.o DrawIString.o DrawString.o \
DrawingArea.o Frame.o Group.o Gterm.o Icon.o iconutil.o Label.o \
MenuBar.o MultiList.o RadioGrp.o RowCol.o Scrollbar.o \
Layout.o laygram.o laylex.o \
laygram.o laylex.o Layout.o \
Slider2.o Tablist2Tabs.o TextWidth.o Toggle.o cvtLong.o scroll.o \
strnchr.o Tabs.o Gcs.o ListTree.o Separator.o Container.o color.o

Expand All @@ -24,15 +24,10 @@ Gterm.o: Gterm.c GtermCnv.c GtermGraphics.c GtermImaging.c \
GtermCmap.c GtermMapping.c GtermMarker.c GtermUtil.c GtermDebug.c

clean:
rm -f $(OBJS)
rm -f $(OBJS) laygram.[ch] laylex.[ch]

laygram.c: laygram.y
yacc -d laygram.y
sed -e 's/yy/LayYY/g' y.tab.c > laygram.c
sed -e 's/yy/LayYY/g' y.tab.h > laygram.h
rm y.tab.c y.tab.h
.y.c:
yacc -d $< -o $@ -p LayYY

laylex.c: laylex.l
lex laylex.l
sed -e 's/yy/LayYY/g' lex.yy.c > laylex.c
rm lex.yy.c
.l.c:
lex -o $@ -P LayYY $<
5 changes: 5 additions & 0 deletions obm/ObmW/laygram.y
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
#include "LayoutP.h"

static LayoutPtr *dest;
#define yysetdest LayYYsetdest
#define yywrap LayYYwrap
#define yyerror LayYYerror
extern int layYYlex ( void );
extern void yyerror(char *s);

%}

Expand Down
20 changes: 10 additions & 10 deletions obm/ObmW/laylex.l
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#include "laygram.h"
static char *yysourcebase, *yysource;

#define yylval LayYYlval
#define yyerror LayYYerror
#define yysetsource LayYYsetsource

#ifndef FLEX_SCANNER
#define input() (*yysource++)
#define unput(c) (--yysource)
Expand All @@ -24,7 +28,7 @@ static void my_yyinput(char *buf, int *result, int max_size);
#endif

#ifdef __STDC__
static int count ();
static int count (char *s, char c);
#endif
%}
%%
Expand Down Expand Up @@ -75,9 +79,7 @@ height return HEIGHT;
%%

static int
count (s, c)
char *s;
char c;
count (char *s, char c)
{
int i = 0;
while (*s)
Expand All @@ -86,14 +88,13 @@ count (s, c)
return i;
}

yysetsource(s)
char *s;
yysetsource(char *s)
{
yysourcebase = yysource = s;
}

yyerror(s)
char *s;
void
yyerror(char *s)
{
char *t;

Expand All @@ -115,8 +116,7 @@ yyerror(s)

#ifdef FLEX_SCANNER
static void
my_yyinput(buf, result, max_size)
char *buf; int *result; int max_size;
my_yyinput(char *buf, int *result, int max_size)
{
int size = max_size < strlen(yysource) ? max_size : strlen(yysource);

Expand Down

0 comments on commit fff7284

Please sign in to comment.