* lang_js/parsing/lexer_js.mll: estet
* lang_js/parsing/parse_js.ml: misc
[hackjs] support for class in grammar

Summary:
Mostly following
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions

Next diff will add support for it in the AST

Task ID: #

Reviewers: jeffmo, avik, sstur

CC:

Test Plan:
$ ~/pfff/pfff -parse_js tests/js/parsing/class.js
$ ~/pfff/pfff -parse_js ~/www
...
NB total files = 16126; perfect = 13672; =========> 84%
nb good = 1518143,  nb bad = 436162 =========> 77.681989%

So go from 63% to 77% coverage on www.
* tests/js/parsing/sc.js: test
* lang_js/parsing/ast_js.ml:
* lang_js/parsing/test_parsing_js.ml: comment
[hackjs] support for JSX part1, hack on the lexer

Summary:
This is mostly a copy paste of the techniques I used
a long time ago to handle XHP in PHP.

Next diff will add support for JSX in the grammar

Test Plan:
$ ~/pfff/pfff -tokens_js xhp_quote.js
Tag4 (["x"; (("x", 0, 1, 0, "xhp_quote.js"))])
([((" ", 1, 1, 1, "xhp_quote.js"))])
Tag56 ([(("=", 2, 1, 2, "xhp_quote.js"))])
([((" ", 3, 1, 3, "xhp_quote.js"))])
Tag87 (["tag"; (("<tag", 4, 1, 4, "xhp_quote.js"))])
Tag89 ([((">", 8, 1, 8, "xhp_quote.js"))])
Tag92 (["This contains a fucking' which can confuse parsers"; (("This contains a fucking' which can confuse parsers", 9, 1, 9, "xhp_quote.js"))])
Tag88 ([("tag"); (("</tag>", 59, 1, 59, "xhp_quote.js"))])
Tag42 ([((";", 65, 1, 65, "xhp_quote.js"))])
Tag1 ([(("\n", 66, 1, 66, "xhp_quote.js"))])
Tag95 ([(("", 67, 1, 0, "xhp_quote.js"))])

which shows that the quite does not create any problem and that
the text is lexed as a single token

Reviewers: jeffmo, avik

Reviewed By: avik

Differential Revision: https://phabricator.fb.com/D996714
[hackjs] support for JSX part2, grammar extension

Summary:
It can now parse 90% of the js code in www

Remaining constructs:
 - arrows,
 - mixins,
 - JSX attribute names can contain':',
 - class expression
 - 'class' can be a property name
 - JSX can be inside arrays
 - trailing additional comma is ok
 - misc stuff

Test Plan: unit test included

Reviewers: avik, jeffmo, sstur

Reviewed By: avik

CC: bhosmer

Differential Revision: https://phabricator.fb.com/D996776
fix
[hackjs] AST support for js classes

Test Plan:
$ ~/pfff/pfff -dump_js class.js
[ClassDecl({c_tok=(); c_name=("Foo", ()); c_extends=None; c_body=[]; });
 ClassDecl(
   {c_tok=(); c_name=("Bar", ()); c_extends=Some(((), V(("Foo", ()))));
    c_body=[Method(None, (None, Some(("method1", ())), [], []));
            ClassExtraSemiColon(None);
            Method(None,
              (None, Some(("method2", ())), [("a", ()); ("b", ())], []));
            ClassExtraSemiColon(None)];
    }); St(Nop(None)); FinalDef(())]

Reviewers: avik, jeffmo

Reviewed By: avik

Differential Revision: https://phabricator.fb.com/D996898
[hackjs] support for JSX in AST

Test Plan:
$ ~/pfff/pfff -dump_js xhp.js
[FunDecl(
   (Some(()), Some(("test", ())), [],
    [St(
       Return((),
         Some(Paren(
                XhpHtml(
                  Xhp(("div", ()),
                    [(("className", ()), (),
                      XhpAttrExpr(
                        Apply(V(("cx", ())),
                          [L(String(("adsCFSection/root", ())))])))], (),
                    [XhpText(("
        ", ()));
                     XhpNested(
                       Xhp(("h1", ()), [], (),
                         [XhpText(("UNDER CONSTRUCTION", ()))],
                         (Some("h1"), ()))); XhpText(("
        ", ()));
                     XhpNested(
                       Xhp(("InfoTable", ()),
                         [(("sectionborders", ()), (),
                           XhpAttrExpr(L(Bool((true, ())))))], (),
                         [XhpText(("
          ", ()));
                          XhpExpr(
                            Period(Period(This(()), (), ("props", ())), (),
                              ("mobilePlatformEditor", ())));
                          XhpText(("
          ", ()));
                          XhpExpr(
                            Period(Period(This(()), (), ("props", ())), (),
                              ("demographicsEditor", ())));
                          XhpText(("
        ", ()))],
                         (Some("InfoTable"), ()))); XhpText(("
      ", ()))],
                    (Some("div"), ()))))), Some(())))])); St(Nop(None));
 FinalDef(())]

Reviewers: avik, jeffmo

Reviewed By: avik

Differential Revision: https://phabricator.fb.com/D996918