# [PATCH] Scanner fixes and tweaks

- Thread: https://externals.io/message/36874
- Original archive: https://news-web.php.net/php.internals/36874
- Started by Matt Wilmas on 2008-04-08T15:58:48+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #36874 — Matt Wilmas — 2008-04-08T15:58:48+00:00

URL: https://externals.io/message/36874#36874

Hi all,

First, I just realized while going through the scanner code after the re2c
changes that there's a bug with heredoc handling (from my code changes last
year, oops) on something like:

<<<EOT
text
fooEOT
text
EOT;

Patch for 5.2 with just that fix:
http://realplain.com/php/heredoc_fix_5_2.diff

For 5.3 and HEAD, I fixed problems with yyleng (some would only affect
highlighting, tokenizer ext, etc.)  Double quoted heredocs with tabs/spaces
wouldn't work right (ex: <<<   "EOT").  Updated some comments.  And this
rule that was added...

<ST_LOOKING_FOR_PROPERTY>{WHITESPACE}+ {
    /* do nothing */
    goto restart;
}

Would lose that whitespace in highlighter, etc. or miss counting line
numbers.  Speaking of line numbers, I also removed the
CG(comment_start_line) variable since I can't see that it's needed anywhere,
and CG(zend_lineno) works for the "Unterminated comment..." warning (which
isn't working right now anyway :-)).

In HEAD I also tidied up the LNUM/HNUM rules which lost their tabs and Z_*
macros a year ago (v1.164).

http://realplain.com/php/scanner_fixes.diff
http://realplain.com/php/scanner_fixes_5_3.diff


- Matt
