Add markup syntax for a literal block

Summary:
Lines starting with the '|' character will undergo no further
markup processing.

Test Plan:
Tested in sandbox.  Verified that other remarkup on lines prefixed
with '|' did not get processed.

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, andrewjcg, epriestley

Differential Revision: https://secure.phabricator.com/D1293
Add getNextToken() and getPrevToken() methods to AASTToken

Summary: Used in D1312.

Test Plan: D1312 works.

Reviewers: btrahan, jungejason, kiyoto

Reviewed By: jungejason

CC: aran, epriestley, jungejason

Differential Revision: https://secure.phabricator.com/D1312
Update libphutil README

Summary: Flesh this out a little bit, it looks a little sketch saying "a few
months" and being like 8 months old.

Test Plan: none whatsoever

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran, btrahan

Differential Revision: https://secure.phabricator.com/D1325
Allow Remarkup headers to generate a TOC

Summary: Allow header rules to generate with anchors and build a table of
contents.

Test Plan:
https://secure.phabricator.com/file/view/PHID-FILE-lttr6jszx2y2rqjpalr6/

Reviewers: btrahan, jungejason, davidreuss

Reviewed By: btrahan

CC: aran, btrahan

Differential Revision: https://secure.phabricator.com/D1334
add the method to access the last item in an array without
chocking

Summary: Add method last() which is very similar to head()

Test Plan:
  - this has been used in Facebook code like head().
  - used it in D1344

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1343
Add a blanket guard for 'javascript:' hrefs in libphutil

Summary:
In our application (and, I claim in the comments, any "well designed"
application) these are never intentional and always indicate an attack vector.
D1365 closes such a vector (albeit an admin-only one), but we can also just put
a blanket check here.

On its own this would be a poor approach because it's a blacklist rather than a
whitelist (it does nothign about these URIs in other attributes, or about other
dangerous URIs), but I think it's a reasonable compliment to other mechanisms
and practices, like the SQL syntax error checks.

Test Plan:
  - Ran unit tests.
  - Browsed site.
  - Profiled some heavy pages, this adds less than a millisecond to a 1000-task
Maniphest list.

Reviewers: btrahan, jungejason, arice

Reviewed By: arice

CC: aran, arice, epriestley

Differential Revision: https://secure.phabricator.com/D1366
Allow the docblock parser to handle hyphens in "@specials"

Summary: Trying to add one named "@phutil-external-symbol" and it doesn't work
right now because "-" is not in \w.

Test Plan: Unit tests.

Reviewers: btrahan, jungejason

Reviewed By: jungejason

CC: aran, jungejason

Maniphest Tasks: T762

Differential Revision: https://secure.phabricator.com/D1380
Separate storing of rendered hyperlinks in remarkup hyperlink rule

Summary: Benefit of this separation is that custom hyperlink rule may decide not
to process given link. Such text will continue to be accessible for other
remarkup rules (e.g. imageproxy, youtube, etc.)

Test Plan: Checked that links are still properly displayed in differential. This
change should not affect existing applications.

Reviewers: jungejason, epriestley

Reviewed By: jungejason

CC: aran, jungejason

Differential Revision: https://secure.phabricator.com/D1389
Normalize some php.ini configuration in daemon scripts

Summary: Users may set 'error_log' to something other than the default, which
confusingly writes error data somewhere other than the console when running
exec_daemon.php or "phd debug". Force error-related configuration to the values
we expect.

Test Plan: Applied patch on a box with 'error_log' set to 'error_log', got
useful information on stderr and information propagation via "phd debug".

Reviewers: btrahan, jungejason

Reviewed By: jungejason

CC: aran, jungejason

Differential Revision: https://secure.phabricator.com/D1402
Add a "this is a conduit request" hint to ConduitClient.

Summary: See D1407.

Test Plan: Ran a valid command, worked; ran a mangled path command, got a good
error.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D1408
Add a simple option parser for comma-delimited lists, and add more features to
Remarkup code blocks

Summary:
  - Add a parser for lang=php, lines=10, name=example.conf type stuff.
  - Add those features to code blocks.

Test Plan:
  - Unit tests.
  - Made code blocks with the new features in Phabricator.

Reviewers: davidreuss, btrahan, jungejason

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T336

Differential Revision: https://secure.phabricator.com/D1416
Improve libphutil documentation

Summary: Coarse pass to slightly improve the state of the documentation.

Test Plan: Regenerated, read documentation.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D1425
Move utf8 HTML hardwrapping to libphutil

Summary: DifferentialChangesetParser is a huge stupid mess. Move this part of it
to libphutil and add some test coverage.

Test Plan: Ran unit tests.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D1433
Add a very basic AWS API to libphutil

Summary:
I want programmatic access to EC2 in order to make DryDock do something
nontrivial. The two major PHP EC2 implementations I could find weren't thrilling
to me:

  - AWS PHP SDK: http://aws.amazon.com/sdkforphp/ - Major drawback is that it's
gigantic (27,000 lines) and very heavyweight (defines its own array-like class,
for instance).
  - Amazon EC2 Client in PHP: http://aws.amazon.com/code/442 - Lightweight, but
uses SOAP and thus has 1K lines of envelope-signing stuff. Defines a bunch of
classes like "images" and "groups". Assumes key information is in declare()s,
etc.

Instead, just provide simple Query API access on top of Futures.

Test Plan:
Wrote a little script like this:

  #!/usr/bin/env php
  <?php

  $root = dirname(dirname(dirname(__FILE__)));
  require_once $root.'/scripts/__init_script__.php';

  $future = new PhutilAWSEC2Future();
  $future->setAWSKeys(
    'YOUR-ACCESS-KEY',
    'YOUR-PRIVATE-KEY');

  $future->setRawAWSQuery(
    'DescribeInstances',
    array(
    ));

  var_dump($future->resolve());

...and issued some queries, including allocating an instance.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D1452
Minor, fix spelling mistake detected by spelling linter.
Add a "concrete only" flag to PhutilSymbolLoader

Summary: We have a few cases where we only want to load //concrete// subclasses.
Currently, we have the same ReflectionClass block copy/pasted a few places;
simplify it by putting the logic in PhutilSymbolLoader.

Test Plan: Modified Drydock, Conduit and phd to use setConcreteOnly(), ran "phd
list", visited conduit API console, hit Drydock "allocate resource" endpoint,
saw correct behavior.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T801

Differential Revision: https://secure.phabricator.com/D1486
Improve Docblock parser handling of "@flags"

Summary:
Allow the docblock parser to handle "@specials" with no value, like "@stable",
more gracefully, by treating them as flags.

Also improve extraction of docblock text from docblocks with mixed-order
specials and text.

Test Plan: This class is extensively covered by unit tests.

Reviewers: btrahan, nh, jungejason

Reviewed By: nh

CC: aran, epriestley

Maniphest Tasks: T795

Differential Revision: https://secure.phabricator.com/D1508
Mark all libphutil stable classes as @stable

Summary: Provide an explicit hint about stability/extensibility for
documentation.

Test Plan: Regenerated documentation, looked at @stable and not-@stable classes.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T795

Differential Revision: https://secure.phabricator.com/D1502
Remove XHP and yield support from XHPAST

Summary: Remove XHP and yield support from the lexer and parser. I'll rename
xhpast to phpast at some point, too.

Test Plan: Ran all arcanist and libphutil unit tests. Ran library mapper on all
the projects.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran, pad, jungejason, btrahan, epriestley

Maniphest Tasks: T635

Differential Revision: https://secure.phabricator.com/D1319
Mark all final-izable classes in libphutil as 'final'

Summary: Resolves all "not abstract or final" lint warnings in libphutil by
"final"-izing anything that isn't explicitly extensible.

Test Plan: Ran lint; no class errors. Ran testEverythingImplemented in
phabricator.

Reviewers: btrahan, aran, jungejason

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T795

Differential Revision: https://secure.phabricator.com/D1512