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
F18759878: D8032.id18176.diff
Mon, Oct 6, 6:27 AM
F18733199: D8032.diff
Tue, Sep 30, 10:03 PM
F18628596: D8032.id.diff
Tue, Sep 16, 6:41 AM
F18623779: D8032.diff
Mon, Sep 15, 5:36 PM
F18621841: D8032.diff
Mon, Sep 15, 9:36 AM
F18619645: D8032.id.diff
Mon, Sep 15, 3:01 AM
F18585738: D8032.diff
Sep 11 2025, 4:17 PM
F18459192: D8032.id18176.diff
Sep 1 2025, 4:31 PM
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).