-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic Hack support #712
Conversation
Is there a problem with this, or just not got to it yet? |
lib/rouge/lexers/hack.rb
Outdated
aliases 'hack', 'hh' | ||
filenames '*.php', '*.hh' | ||
|
||
def self.analyze_text(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filetype guesser is changed in #763
Can you take a look at it?
See hacklang.org Changes to PHP and C++ (and corresponding tests) to make sure that ambiguities are covered. Will add XHP support in a separate pull request. refs rouge-ruby#392
@gfx: done, thanks, and squashed it down to one as the history was more confusing than useful |
lib/rouge/guessers/disambiguation.rb
Outdated
disambiguate '*.hh' do | ||
next Cpp if matches?(/^\s*#include/) | ||
next Hack if matches?(/^<\?hh/) | ||
next Hack if matches?(/\):\s*Awaitable</) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: Awaitable
is a valid syntax C++, so it shouldn't be here.
There's also a leading close parents in the pattern; is |
Also, is your objective to never pick Hack if it could be C++, or to pick the most likely? Even if |
I think it never pick Hack over C++ if it might be C++ when ambiguous. If you declare a source is Hack, you can easily use |
Thanks. LGTM. |
See hacklang.org
Changes to PHP and C++ (and corresponding tests) to make sure that
ambiguities are covered.
Will add XHP support in a separate pull request.
refs #392