1
/* parser.h - prototypes for the command line parser. */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2005 Free Software Foundation, Inc.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#ifndef GRUB_PARSER_HEADER
22
#define GRUB_PARSER_HEADER 1
24
#include <grub/types.h>
27
/* All the states for the command line. */
30
GRUB_PARSER_STATE_TEXT = 1,
31
GRUB_PARSER_STATE_ESC,
32
GRUB_PARSER_STATE_QUOTE,
33
GRUB_PARSER_STATE_DQUOTE,
34
GRUB_PARSER_STATE_VAR,
35
GRUB_PARSER_STATE_VARNAME,
36
GRUB_PARSER_STATE_VARNAME2,
37
GRUB_PARSER_STATE_QVAR,
38
GRUB_PARSER_STATE_QVARNAME,
39
GRUB_PARSER_STATE_QVARNAME2
40
} grub_parser_state_t;
42
/* A single state transition. */
43
struct grub_parser_state_transition
45
/* The state that is looked up. */
46
grub_parser_state_t from_state;
48
/* The next state, determined by FROM_STATE and INPUT. */
49
grub_parser_state_t to_state;
51
/* The input that will determine the next state from FROM_STATE. */
54
/* If set to 1, the input is valid and should be used. */
58
/* Determines the state following STATE, determined by C. */
60
EXPORT_FUNC (grub_parser_cmdline_state) (grub_parser_state_t state,
61
char c, char *result);
64
EXPORT_FUNC (grub_parser_split_cmdline) (const char *cmdline,
65
grub_err_t (*getline) (char **),
66
int *argc, char ***argv);
68
#endif /* ! GRUB_PARSER_HEADER */