mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
hopefully make line directives work
This commit is contained in:
parent
90b5c57266
commit
625915288c
3 changed files with 21 additions and 9 deletions
|
@ -7,9 +7,7 @@
|
|||
|
||||
#define YY_NO_UNPUT
|
||||
|
||||
int lineno;
|
||||
|
||||
void error (char*s){fprintf(stderr,"%d: %s\n",lineno,s);}
|
||||
void error (char*s){fprintf(stderr,"%d: %s\n",pr_source_line,s);}
|
||||
|
||||
int type_or_name (char *token);
|
||||
|
||||
|
@ -45,7 +43,7 @@ m ([\-+]?)
|
|||
if (c == EOF)
|
||||
error ("EOF in comment");
|
||||
if (c == '\n')
|
||||
lineno++;
|
||||
pr_source_line++;
|
||||
} while (c != '/' && c != EOF);
|
||||
}
|
||||
|
||||
|
@ -83,6 +81,21 @@ m ([\-+]?)
|
|||
}
|
||||
|
||||
^#{s}+{DIGIT}+{s}+\"(\.|[^"])*\".*$ {
|
||||
char *p;
|
||||
int line;
|
||||
|
||||
pr_file_p = yytext + 1;
|
||||
line = strtol (pr_file_p, &p, 10);
|
||||
pr_file_p = p;
|
||||
while (isspace (*pr_file_p))
|
||||
pr_file_p++;
|
||||
if (!*pr_file_p)
|
||||
PR_ParseError ("Unexpected end of file");
|
||||
PR_LexString (); // grab the filename
|
||||
while (*pr_file_p && *pr_file_p != '\n') // ignore flags
|
||||
pr_file_p++;
|
||||
pr_source_line = line - 1;
|
||||
s_file = ReuseString (pr_immediate_string);
|
||||
}
|
||||
|
||||
"!"|"("|")"|"{"|"}"|"."|"*"|"/"|"&"|"|"|"+"|"-"|"="|"["|"]"|";"|","|"#" return yytext[0];
|
||||
|
@ -111,7 +124,7 @@ m ([\-+]?)
|
|||
<grab_other>[^\n]* /* skip */
|
||||
|
||||
<*>\n {
|
||||
lineno++;
|
||||
pr_source_line++;
|
||||
BEGIN (INITIAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
#define YYERROR_VERBOSE 1
|
||||
|
||||
extern char *yytext;
|
||||
extern int lineno;
|
||||
extern int pr_source_line;
|
||||
|
||||
void
|
||||
yyerror (const char *s)
|
||||
{
|
||||
fprintf (stderr, "%d, %s %s\n", lineno, yytext, s);
|
||||
fprintf (stderr, "%d, %s %s\n", pr_source_line, yytext, s);
|
||||
}
|
||||
|
||||
int yylex (void);
|
||||
|
|
|
@ -906,7 +906,6 @@ Options: \n\
|
|||
#ifdef NEW_PARSER
|
||||
extern FILE *yyin;
|
||||
int yyparse(void);
|
||||
extern int lineno;
|
||||
extern void clear_frame_macros (void);
|
||||
//extern int yydebug;
|
||||
//yydebug = 1;
|
||||
|
@ -916,7 +915,7 @@ Options: \n\
|
|||
|
||||
yyin = fopen (filename, "rt");
|
||||
s_file = ReuseString (filename);
|
||||
lineno = 1;
|
||||
pr_source_line = 1;
|
||||
clear_frame_macros ();
|
||||
if (yyparse ()) {
|
||||
printf ("%s\n", filename);
|
||||
|
|
Loading…
Reference in a new issue