1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3  * mk-scanner.h
4  * Copyright (C) Sébastien Granjoux 2009 <seb.sfo@free.fr>
5  *
6  * main.c is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * main.c is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef _MK_SCANNER_H_
21 #define _MK_SCANNER_H_
22 
23 #include "mk-project.h"
24 
25 #include "libanjuta/anjuta-token.h"
26 #include "libanjuta/anjuta-token-file.h"
27 #include "libanjuta/anjuta-token-list.h"
28 
29 #include <glib.h>
30 #include <gio/gio.h>
31 
32 G_BEGIN_DECLS
33 
34 /* Token location is found directly from token value. We don't maintain a
35  * independent position. */
36 #define YYLTYPE AnjutaToken*
37 #define YYSTYPE AnjutaToken*
38 
39 typedef struct _MkpScanner MkpScanner;
40 
41 MkpScanner *mkp_scanner_new (MkpProject *project);
42 void mkp_scanner_free (MkpScanner *scanner);
43 
44 AnjutaToken *mkp_scanner_parse_token (MkpScanner *scanner, AnjutaToken *token, GError **error);
45 
46 void mkp_scanner_update_variable (MkpScanner *scanner, AnjutaToken *variable);
47 void mkp_scanner_parse_variable (MkpScanner *scanner, AnjutaToken *variable);
48 void mkp_scanner_add_rule (MkpScanner *scanner, AnjutaToken *rule);
49 
50 void mkp_yyerror (YYLTYPE *loc, MkpScanner *scanner, char const *s);
51 
52 typedef enum
53 {
54 	MK_TOKEN_RULE = ANJUTA_TOKEN_USER,
55 	MK_TOKEN_EQUAL,
56 	MK_TOKEN_IMMEDIATE_EQUAL,
57 	MK_TOKEN_CONDITIONAL_EQUAL,
58 	MK_TOKEN_APPEND,
59 	MK_TOKEN_TARGET,
60 	MK_TOKEN_PREREQUISITE,
61 	MK_TOKEN_ORDER_PREREQUISITE,
62 	MK_TOKEN_ORDER,
63 	MK_TOKEN_COMMAND,
64 	MK_TOKEN_COMMANDS,
65 	MK_TOKEN_COLON,
66 	MK_TOKEN_DOUBLE_COLON,
67 	MK_TOKEN_VARIABLE,
68 	MK_TOKEN__PHONY,
69 	MK_TOKEN__SUFFIXES,
70 	MK_TOKEN__DEFAULT,
71 	MK_TOKEN__PRECIOUS,
72 	MK_TOKEN__INTERMEDIATE,
73 	MK_TOKEN__SECONDARY,
74 	MK_TOKEN__SECONDEXPANSION,
75 	MK_TOKEN__DELETE_ON_ERROR,
76 	MK_TOKEN__IGNORE,
77 	MK_TOKEN__LOW_RESOLUTION_TIME,
78 	MK_TOKEN__SILENT,
79 	MK_TOKEN__EXPORT_ALL_VARIABLES,
80 	MK_TOKEN__NOTPARALLEL,
81 } MakeTokenType;
82 
83 G_END_DECLS
84 
85 #endif
86