summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2001-05-08 19:42:14 +0000
committerAndi Gutmans <andi@php.net>2001-05-08 19:42:14 +0000
commita514e8fe6621d54cfd387fca993846c2be9cc4c8 (patch)
tree491681f6ba197beb494c687ded505c69c61fc623
parent8a030b980931c4dad51b894166ae2cda8a303443 (diff)
downloadphp-git-a514e8fe6621d54cfd387fca993846c2be9cc4c8.tar.gz
- Fix line numbers when some lines end with \r
-rw-r--r--Zend/zend_language_scanner.l25
1 files changed, 14 insertions, 11 deletions
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 82aa8b9a03..d060081cbd 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -94,20 +94,23 @@
#define YY_FATAL_ERROR zend_fatal_scanner_error
-#define HANDLE_NEWLINES(s,l) \
-do { \
- char *p = (s),*boundary = p+(l); \
-\
- while (p<boundary) { \
- if (*p++=='\n') { \
- CG(zend_lineno)++; \
- } \
- } \
+#define HANDLE_NEWLINES(s,l) \
+do { \
+ char *p = (s),*boundary = p+(l); \
+ \
+ while (p<boundary) { \
+ if (*p == '\n') { \
+ CG(zend_lineno)++; \
+ } else if ((*p == '\r') && (p+1 < boundary) && (*(p+1) != '\n')) { \
+ CG(zend_lineno)++; \
+ } \
+ p++; \
+ } \
} while (0)
#define HANDLE_NEWLINE(c) \
{ \
- if (c=='\n') { \
+ if (c == '\n' || c == '\r') { \
CG(zend_lineno)++; \
} \
}
@@ -1117,7 +1120,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
-<INITIAL>"<?php"[ \n\r\t] {
+<INITIAL>"<?php"([ \t]|{NEWLINE}) {
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
zendlval->type = IS_STRING;