lexer rules relaxed a little; please, don't use tokens like abc: -- use "abc:" instead
[k8jam.git] / src / scan.h
blob831527fe66815dcb22f00c8aa65d45756684fbab
1 /*
2 * Copyright 1993, 1995 Christopher Seiwald.
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6 /*
7 * scan.h - the jam yacc scanner
9 * External functions:
11 * yyerror(char *s) - print a parsing error message
12 * yyfparse(char *s) - scan include file s
13 * yylex() - parse the next token, returning its type
14 * yymode() - adjust lexicon of scanner
15 * yyparse() - declaration for yacc parser
16 * yyanyerrors() - indicate if any parsing errors occured
18 * The yymode() function is for the parser to adjust the lexicon of the
19 * scanner. Aside from normal keyword scanning, there is a mode to
20 * handle action strings (look only for the closing }) and a mode to
21 * ignore most keywords when looking for a punctuation keyword. This
22 * allows non-punctuation keywords to be used in lists without quoting.
24 * 11/04/02 (seiwald) - const-ing for string literals
26 #ifndef JAMH_SCAN_H
27 #define JAMH_SCAN_H
31 * YYSTYPE - value of a lexical token
33 #define YYSTYPE YYSYMBOL
35 typedef struct _YYSTYPE {
36 int type;
37 const char *string;
38 PARSE *parse;
39 LIST *list;
40 int number;
41 } YYSTYPE;
43 extern YYSTYPE yylval;
45 extern void yymode (int n);
46 extern void yyerror (const char *s);
47 extern int yyanyerrors (void);
48 extern void yyfparse (const char *s);
49 extern int yyline (void);
50 extern int yylex (void);
51 extern int yyparse (void);
54 enum {
55 SCAN_NORMAL, /* normal parsing */
56 SCAN_STRING, /* look only for matching } */
57 SCAN_PUNCT /* only punctuation keywords */
61 #endif