aboutsummaryrefslogtreecommitdiff
path: root/src/git-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/git-parser.c')
-rw-r--r--src/git-parser.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/git-parser.c b/src/git-parser.c
index e0675ef..117a8fc 100644
--- a/src/git-parser.c
+++ b/src/git-parser.c
@@ -38,34 +38,45 @@ struct token {
int type;
char *buf;
char *tag;
char chbuf[2];
int putback;
} tok;
#define ISSPACE(c) (strchr(" \t\r\f\n", c) != NULL)
#define ISIDENT(c) ((isascii(c) && isalnum(c)) || (c) == '_')
#define ISINITIAL(c) ((isascii(c) && isalpha(c)) || (c) == '_')
static int
-input()
+rawinput()
{
if (!infile || feof(infile))
return 0;
input_char = fgetc(infile);
if (input_char == '\n')
grecs_current_locus.line++;
return input_char;
}
+static int
+input()
+{
+ rawinput();
+ if (input_char == '#') {
+ while (rawinput() && input_char != '\n')
+ ;
+ }
+ return input_char;
+}
+
static void
unput()
{
if (!input_char)
return;
if (input_char == '\n')
grecs_current_locus.line--;
ungetc(input_char, infile);
}
static void
error_recovery()
@@ -78,25 +89,25 @@ static void
collect_tag()
{
while (input() &&
!(ISSPACE(input_char) || input_char == ']'))
grecs_txtacc_grow_char(acc, input_char);
grecs_txtacc_grow_char(acc, 0);
tok.tag = grecs_txtacc_finish(acc, 0);
}
static void
collect_string()
{
- while (input()) {
+ while (rawinput()) {
if (input_char == '\\') {
if (!input()) {
grecs_error(&grecs_current_locus, 0,
"unexpected EOF in string");
break;
}
} else if (input_char == '"')
break;
grecs_txtacc_grow_char(acc, input_char);
}
grecs_txtacc_grow_char(acc, 0);
tok.tag = grecs_txtacc_finish(acc, 0);

Return to:

Send suggestions and report system problems to the System administrator.