00001 /* 00002 * Copyright 1993, 1995 Christopher Seiwald. 00003 * 00004 * This file is part of Jam - see jam.c for Copyright information. 00005 */ 00006 00007 /* 00008 * scan.h - the jam yacc scanner 00009 * 00010 * External functions: 00011 * 00012 * yylex() - parse the next token, returning its type 00013 * yymode() - adjust lexicon of scanner 00014 * yyparse() - declaration for yacc parser 00015 * yyanyerrors() - indicate if any parsing errors occured 00016 * yyerror( char *s ) - print a parsing error message 00017 * yyfparse( char *s ) - scan include file s 00018 * 00019 * The yymode() function is for the parser to adjust the lexicon of the 00020 * scanner. Aside from normal keyword scanning, there is a mode to 00021 * handle action strings (look only for the closing }) and a mode to 00022 * ignore most keywords when looking for a punctuation keyword. This 00023 * allows non-punctuation keywords to be used in lists without quoting. 00024 * 00025 * Changes: 00026 * 00027 * 11/04/02 (seiwald) - const-ing for string literals 00028 */ 00029 00030 /* 00031 * YYSTYPE - value of a lexical token 00032 */ 00033 00034 # define YYSTYPE YYSYMBOL 00035 00036 typedef struct _YYSTYPE { 00037 int type; 00038 const char *string; 00039 PARSE *parse; 00040 LIST *list; 00041 int number; 00042 } YYSTYPE; 00043 00044 extern YYSTYPE yylval; 00045 00046 void yymode( int n ); 00047 void yyerror( const char *s ); 00048 int yyanyerrors(); 00049 void yyfparse( const char *s ); 00050 int yyline(); 00051 int yylex(); 00052 int yyparse(); 00053 00054 # define SCAN_NORMAL 0 /* normal parsing */ 00055 # define SCAN_STRING 1 /* look only for matching } */ 00056 # define SCAN_PUNCT 2 /* only punctuation keywords */