/* ** grammar for xgc syntax */ /* $XFree86: xc/programs/xgc/gram.y,v 1.3 2000/02/17 14:00:36 dawes Exp $ */ %{ #define YYDEBUG 1 #include #include #include #include "xgc.h" extern int yylineno; %} %union { int num; char *ptr; }; %token STRING %token NUMBER %token RUN %token FUNCTION FUNCTIONTYPE %token TEST TESTTYPE %token LINESTYLE LINESTYLETYPE %token CAPSTYLE CAPSTYLETYPE %token JOINSTYLE JOINSTYLETYPE %token ROUND SOLID %token FILLSTYLE FILLSTYLETYPE %token FILLRULE FILLRULETYPE %token ARCMODE ARCMODETYPE %token FOREGROUND BACKGROUND LINEWIDTH PLANEMASK DASHLIST PERCENT %token FONT %% all : stmts ; stmts : /* empty */ | stmts '\n' | stmts stmt '\n' ; stmt : error | RUN { run_test(); } | TEST TESTTYPE { change_test ($2, TRUE); } | FUNCTION FUNCTIONTYPE { GC_change_function ($2, TRUE); } | LINESTYLE LINESTYLETYPE { GC_change_linestyle ($2, TRUE); } | LINESTYLE SOLID { GC_change_linestyle (LineSolid, TRUE); } | CAPSTYLE CAPSTYLETYPE { GC_change_capstyle ($2, TRUE); } | CAPSTYLE ROUND { GC_change_capstyle (CapRound, TRUE); } | JOINSTYLE JOINSTYLETYPE { GC_change_joinstyle ($2, TRUE); } | JOINSTYLE ROUND { GC_change_joinstyle (JoinRound, TRUE); } | FILLSTYLE FILLSTYLETYPE { GC_change_fillstyle ($2, TRUE); } | FILLSTYLE SOLID { GC_change_fillstyle (FillSolid, TRUE); } | FILLRULE FILLRULETYPE { GC_change_fillrule ($2, TRUE); } | ARCMODE ARCMODETYPE { GC_change_arcmode ($2, TRUE); } | FOREGROUND NUMBER { GC_change_foreground ($2, TRUE); } | BACKGROUND NUMBER { GC_change_background ($2, TRUE); } | LINEWIDTH NUMBER { GC_change_linewidth ($2, TRUE); } | PLANEMASK NUMBER { GC_change_planemask ($2, TRUE); } | DASHLIST NUMBER { GC_change_dashlist ($2, TRUE); } | FONT STRING { GC_change_font ($2, TRUE); } | PERCENT NUMBER { change_percent ($2, TRUE); } ; %% void yyerror(const char *s) { fprintf(stderr, "xgc: syntax error, line %d\n", yylineno); }