Page MenuHomePhabricator

Align PHPAST lexer to PHP 5.5.8
ClosedPublic

Authored by epriestley on Jan 21 2014, 8:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 21 2025, 6:32 PM
Unknown Object (File)
Apr 10 2025, 3:57 PM
Unknown Object (File)
Apr 9 2025, 9:33 AM
Unknown Object (File)
Apr 8 2025, 7:05 AM
Unknown Object (File)
Apr 7 2025, 4:17 PM
Unknown Object (File)
Mar 24 2025, 11:12 AM
Unknown Object (File)
Mar 20 2025, 8:30 AM
Unknown Object (File)
Mar 20 2025, 5:44 AM
Subscribers

Details

Summary

Ref T4334. This aligns the lexer (but not the parser) with PHP 5.5.8. It also applies the patch on T3512. This has these positive effects:

  • Fixes binary literals.
  • Fixes empty heredoc.
  • Corrects T_BINARY_CAST into T_STRING_CAST (consistent with 5.5.8).
  • Removes T_UNICODE_CAST (not in 5.5.8).
  • Recognizes keywords trait, __trait__, yield, insteadof, callable.

...these sideways effects:

  • Slightly improves terminal heredocs (previously: parse error; now: bad parse).

...and these negative effects:

  • Breaks the callable test, since callable is now recognized as a keyword but the parser doesn't yet support it.
Test Plan

Rebuilt xhpast, ran unit tests.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

src/parser/xhpast/__tests__/data/php-syntax.php.expect
10848

This is (binary) now being parsed as T_STRING_CAST (like PHP 5.5.8).