Permalink
Browse files

MFZE1

  • Loading branch information...
1 parent 9618e4e commit fac8eaff1a07823fd0fa2e54ef7796d7a9e40307 Ilia Alshanetsky committed Oct 14, 2002
Showing with 12 additions and 6 deletions.
  1. +1 −0 Zend/zend_globals.h
  2. +0 −1 Zend/zend_ini_parser.y
  3. +11 −5 Zend/zend_ini_scanner.l
View
@@ -252,6 +252,7 @@ struct _zend_scanner_globals {
char *c_buf_p;
int init;
int start;
+ int lineno;
char _yy_hold_char;
int yy_n_chars;
int _yy_did_buffer_switch_on_eof;
View
@@ -57,7 +57,6 @@ zval yylval;
#ifndef ZTS
extern int ini_lex(zval *ini_lval TSRMLS_DC);
extern FILE *ini_in;
-extern int ini_lineno;
extern void init_cfg_scanner(void);
#endif
View
@@ -49,15 +49,15 @@ ZEND_API zend_scanner_globals ini_scanner_globals;
static char *ini_filename;
-void init_ini_scanner()
+void init_ini_scanner(TSRMLS_D)
{
- ini_lineno=1;
+ SCNG(lineno)=1;
}
int zend_ini_scanner_get_lineno(TSRMLS_D)
{
- return ini_lineno;
+ return SCNG(lineno);
}
@@ -83,7 +83,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
return FAILURE;
}
- init_ini_scanner();
+ init_ini_scanner(TSRMLS_C);
yyin = fp;
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
ini_filename = fh->filename;
@@ -105,7 +105,6 @@ void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
NEWLINE ("\r"|"\n"|"\r\n")
%option noyywrap
-%option yylineno
%%
@@ -134,6 +133,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
yytext[yyleng]=0;
}
+ SCNG(lineno)++;
+
/* eat leading [ */
yytext++;
yyleng--;
@@ -200,15 +201,20 @@ NEWLINE ("\r"|"\n"|"\r\n")
<INITIAL>[=\n] {
+ if (yytext[0] == '\n') {
+ SCNG(lineno)++;
+ }
return yytext[0];
}
<INITIAL>{NEWLINE} {
+ SCNG(lineno)++;
return '\n';
}
<INITIAL>[;][^\r\n]*{NEWLINE}? {
/* comment */
+ SCNG(lineno)++;
return '\n';
}

0 comments on commit fac8eaf

Please sign in to comment.