added "jammod" command and "genman" module
[k8jam.git] / src / scan.h
blob08da59b0c5e244cd93dbe890dc39e289c0b48af5
1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * scan.h - the jam yacc scanner
20 * The yymode() function is for the parser to adjust the lexicon of the
21 * scanner. Aside from normal keyword scanning, there is a mode to
22 * handle action strings (look only for the closing }) and a mode to
23 * ignore most keywords when looking for a punctuation keyword. This
24 * allows non-punctuation keywords to be used in lists without quoting.
26 #ifndef JAMH_SCAN_H
27 #define JAMH_SCAN_H
31 * token_t - value of a lexical token
33 typedef struct {
34 int type;
35 const char *string;
36 int strlit; /* !0: don't do variable expansion in string */
37 PARSE *parse;
38 LIST *list;
39 int number;
40 int line;
41 int pos;
42 const char *file; // newstr()
43 } token_t;
45 extern token_t yylval;
47 extern void yyerror (const token_t *tk, const char *s);
48 extern void yyfparse (const char *s);
49 extern int yylex (void);
52 enum {
53 SCAN_NORMAL, /* normal parsing */
54 SCAN_STRING, /* look only for matching '}' */
55 SCAN_PUNCT /* only punctuation keywords */
58 extern void yymode (int n);
61 #endif