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
F14898531: D8032.id18176.diff
Sun, Feb 9, 11:14 AM
F14898530: D8032.id18155.diff
Sun, Feb 9, 11:14 AM
F14898529: D8032.id.diff
Sun, Feb 9, 11:14 AM
Unknown Object (File)
Sat, Feb 1, 10:49 PM
Unknown Object (File)
Tue, Jan 28, 2:58 PM
Unknown Object (File)
Tue, Jan 21, 9:10 AM
Unknown Object (File)
Fri, Jan 17, 5:12 PM
Unknown Object (File)
Fri, Jan 17, 4:58 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).