When I run flow on my code (plugin for atom editor - it supports all the latest ES stuff when using use babel directive) I get the following error:
Unexpected token :
16| ::this.openValidator
I don't think flow supports that syntax. Maybe it will in the future.
Related
I would like my Hack code to be broken down to Abstract Syntax Tree. Please advise me on available tools/libraries/github repositories which will help me to parse Hack code into AST.
I have found "h2tp" (hack to php transpiler written by Facebook), however it doesn't parse the code into AST. I also tried this project which does what I want however it is not recognising many of the operators and requires a significant rework, which will quite a lot of time to do.
hhast (HHAST: Low-Level AST Library) lets you do that, you may invoke hh_parse like this : hh_parse --full-fidelity-json $file | jq
taken from (https://github.com/hhvm/hhast/blob/master/docs/ast-lib.md)
The HHVM itself provides a lot of tools to dump the structure of a PHP file. However, the AST dump was removed: https://github.com/facebook/hhvm/issues/1268
What you can do is dump the HHVM assembly language: http://hhvm.com/blog/6323/the-journey-of-a-thousand-bytecodes
HHVM also has a PHP transpiler which may help:https://docs.hhvm.com/hack/tools/transpiler
You could also try to port this extension over to the HHVM: https://github.com/nikic/php-ast
I have been having a heck of a time getting es6 promises to work with Typescript in a ASP.NET 5 project. I installed the es6-promise.d.ts via tsd install es6-promise. However, I get errors about Promise being duplicated. When I hover on the Promise declaration in the es6-promise.d.ts file, I get the error below (see the blue section ac the bottom of the image). It seems to be conflicting with some typescript definition file from a Microsoft SDK, which is obviously not part of my project.
Does anyone have an idea on why this might be happening or how I can fix this?
What version of TypeScript are you using?
Promise is declared in lib.es6.d.ts.
Check your --target option for tsc. If it is equal to es6 then I think you reference the promise definition twice because one is part of tsc compiler.
Dart recently added a support for async/await keywords:
https://www.dartlang.org/articles/await-async/
I tried to run a simple code but Chrome Dev Editor does not recognise async keyword
import 'dart:async';
void main() async {
}
Am I doing something wrong (something to modify in the pubspec.yaml ?) or is it just that this feature is not supported yet on Chrome Dev Editor ?
Edit:
Ok, so for know it seem that async/await seems to be more an experimental feature:
https://www.dartlang.org/docs/dart-up-and-running/ch02.html#async-opt-in
To opt into asynchrony support in Dart Editor, go to Preferences, click Experimental, and select Enable Async Support.
In dart and dartanalyzer, use the --enable-async command-line flag:
dart --enable-async async_await.dart
dartanalyzer --enable-async async_await.dart
Unfortunatly, it seems only to work for Dart Editor, not CDE.
Also, dart does not currently support the conversion into javascript without adding a package:
dependencies:
async_await:
git: https://github.com/dart-lang/async_await.git
transformers:
- async_await
So currently it's not supported.
Now there is an issue on this problem: https://github.com/dart-lang/chromedeveditor/issues/3822
Thank you for all your answer
Wait & see...
Did you import the async module?
From the page you linked:
The features described in this article are still under development. Not all the parts of the system necessarily comply with the spec. Early adopters may need to import dart:async for these features to work. Ultimately, Future should move to dart:core and be universally available.
I'm on my Chromebook right now (and can't verify), but I believe you have to enable it under experimental features in the settings.
I don't know whether this helps with CDE, but the Asynchrony part of the Dart language tour has some information on opting in to asynchrony support for other tools.
I'm working on my first Meteor app, and I'm trying to escape a string on the server side. I was hoping to use Handlebars.Utils.escapeExpression, but even when I add handlebars (which I had to do, even though Meteor already uses it?), I still get
ReferenceError: Handlebars is not defined
error when that code is hit. Is there a way to invoke that method server side without manually including the source in my project?
Meteor uses Handlebars on the client only. Server-side rendering is on the roadmap.
Also, the Handlebars that comes with Meteor doesn't include Utils.
Use {{{thingThatNeedsEscaping}}} instead, as per the documentation that unescapes it.
Also, I don't think it's necessary to escape stuff before inserting it into the database, if you want it though there are other JS functions for that (like escape variants that are not deprecated).
I have the URL / Request Header / POST contents . Is it possible for me to sent the query to the server and get the output HTML and Javascript ?
This is a AJAX stuff , but still I think we can emulate using HTTP .
Is there a convenient method for this using Python ? Or is there a GUI tool ,
that would just lee enter the all the REQUEST HEADER options and also the POST contents and get the desired output ?
On perl you have LWP::UserAgent module. Python have sth similar urllib2 (it should be in core libraries). You may also need "Beautiful Soup" for html/xml parsing.
You can use "wget" which should be available for most distros.
Read up on --post-file and --header.
http://linux.die.net/man/1/wget
In Python you also have Google's httplib2 which has a higher level interface than urllib2.
For further detail see Python urllib vs httplib?