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
Update Perl 6 samples #900
Conversation
Fixed the pull request to use fewer files, and to actually pass the Travis build. =) I'm also curious about the policy on how to include the licenses for sample files, as well as whether or not it would be appropriate to include a Perl 6-specific heuristic in |
Thanks for checking the program for me |
@hoelzro what sort of Perl 6 specific syntax were you thinking of for |
@arfon So for Perl 6, we have two heuristics for disambiguating from Perl 5 according to the spec:
In pygments, I check for these before any other non-empty, non-comment line appears in the file. If they appear, the file is considered Perl 6. Otherwise, it's considered Perl 5. |
Has anyone had a chance to look at this? |
+1 to merge |
👍 |
+1 |
@arfon Is there a way this could get merged within the next week? A lot of Perl 6 code out there is being improperly highlighted, and I saw you folks intend to cut a release sometime next week. It would be really great if this could make it in! |
👍 |
+1! |
Is there anything I can do to help get this merged? The Perl 6 community is still pretty small, but it would make all of us happy! |
Updated with fresh commits. |
I refreshed the commits again, this time removing the update to |
526ed41
to
d94c57c
Compare
Updated against upstream, and included |
@hoelzro - I'd like to get this merged but I'd really rather not make this change to the https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb#L60-L68
|
@arfon That sounds good to me! The heuristic I use for pygments (as well as my Vim setup) involves a little more work (checking for class/module declarations in addition to |
I'd rather keep things as simple as possible if that's ok? |
to be honest, use v6 (or v6 or 6 alone) is only used very rarely so far. on the other hand, having a class or module declaration is a very good sign for perl6 while having a package declaration is a clear sign against perl6 and those two occur much more commonly than "use v6" does ... |
Ok - add in what you think is best and let's have a discussion around the code in the pull request. |
@arfon I added a heuristic for detecting Perl 6 - let me know if it's too complicated. It doesn't work entirely at the moment because |
@hoelzro From what I understand you removed the comments before applying the heuristic. Is it really common to find |
Yeah - agreed. I'd much rather keep to 'simple' regexes rather than having custom pre-processing steps for language files such as the |
Yeah, I'll get rid of that. If things start getting misclassified, I can always add it back! |
Ok, now I remember why stripping the POD/comments are important (and there's actually a bug in what's available now). The Perl 6 spec says that if the first non-comment line is a use Moops;
class Person {
has name => ( is => 'ro', isa => Str );
} If we don't detect POD in particular, things like the following could be missed: =pod
=head1 NAME
FancyRole
=head1 SYNOPSIS
class MyClass with FancyRole { ... }
=cut If you still think this is too complicated logic for the linguist heurstics, maybe Perl 6 vs Perl 5 should rely on the bayesian classifier. |
@hoelzro So you mean that For the shebang detection, do you mean that it doesn't work (gets detected as Perl 5) if you add |
Perl 5 can extend its list of keywords; for example, |
Any other construction specific to Perl 5 that we could use? |
@pchaigno I can't think of anything that would be in a high percentage of Perl 5 programs; just |
Sorry, I meant specific to Perl 6 but I guess Perl 5 keywords can also be used for heuristics. |
Well, I for one would really like the community to get on board with |
So you mean that Perl 5 doesn't have the following Perl 6 constructions? $somevar.somemethod();
$*somevar = $somethingelse; |
Correct. Granted, the former is valid Perl 5 (it just means concatenate |
OK, so while it's not as widespread as we might like, I'd suggest using that for now unless there are better options. Also, would you mind bringing this up to date with master @hoelzro? The heuristics code has been significantly reworked this last week. |
@arfon Done! I've also changed the heuristic to just look for |
- .pm6 | ||
- .t | ||
interpreters: | ||
- perl6 | ||
tm_scope: none |
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.
Is it possible to find a TextMate or Sublime grammar that supports Perl6? I found this one but I'm not sure if it'll work straight out of the box: https://github.com/ashgti/perl-tmbundle Also, it's missing a license.
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.
@arfon That was the one I was recommended; however, does it interfere with https://github.com/textmate/perl.tmbundle?
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.
Ah yes, that will conflict as they're defined with the same name. How well does the standard Perl syntax highlighter do on Perl6 files?
It might be worth trying out https://github.com/textmate/perl.tmbundle on https://lightshow.githubapp.com
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.
I don't think it would do very well; Perl 6 is a very different beast from Perl 5. I know that the pygments and vim highlighters for Perl 5 don't do a very good job with it!
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.
Should we ask https://github.com/ashgti/perl-tmbundle if they can change their scope name?
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.
Yes, that's a good idea.
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.
OK, I'm going to merge this without a tm_scope
at this stage. We can one in later once this naming issue is resolved.
This was performed via `git submodule update --remote`. * vendor/grammars/Agda.tmbundle 784f435...68a218c (1): > Merge pull request #1 from aroben/patch-1 * vendor/grammars/IDL-Syntax 9473b7f...3baeaea (1): > Merge pull request #3 from aroben/patch-1 * vendor/grammars/NimLime 7a2fb4e...9cef4b6 (4): > Updated command names > Updated generated documentation > renamed more from nimrod to nim > Renamed several files * vendor/grammars/SCSS.tmbundle d6188e5...4147502 (1): > Merge pull request #181 from redgluten/master * vendor/grammars/Sublime-VimL 6ab7e19...366fdc6 (1): > Merge pull request #2 from yous/fix-single-quoted-string * vendor/grammars/factor 2dc5590...2453a78 (38): > json.writer: make sure we make hex values two digits zero padded. > json.writer: support escaping unicode > 0x10000. Thanks @jonenst! > mason.git: fix status check. > compiler.cfg.*: new unit test vocabs > compiler.cfg.*: more docs > compiler.cfg.*: refactoring away the compute-global-sets word > compiler.cfg.*: docs and more tests > compiler.cfg.stacks.local: refactoring making stack-changes and height-changes take and return stuff instead of using variables and the make building > compiler.cfg.parallel-copy: docs > compiler.cfg.stacks.height: these words are unused > compiler.cfg.*: more compiler docs > compiler.cfg.stacks.finalize: initial docs > io.launcher: fix stack effects. > io.launcher: fix docs for with-process-reader and with-process-writer. > io.launcher: add versions of with-process that preserve process and status. > mason.git: fix use. > mason.git: fix for rename. > io.launcher: cleanup public interface, make some things private or internal. > gopher: set 1 minute timeout by default. > brainfuck: cleanup tests. > json.writer: don't escape spaces, thats weird. > unix: some using cleanups. > python: rename startup/shutdown hooks. > math.extras: adding the Möbius function. > alien.c-types: move definitions of stdint.h from unix.types. > gopher: use contents now that it works. > io.ports: Make buffered-port not have a length because of Linux virtual files and TCP sockets. Related to issues #1256 and #1259. > tools.deploy.backend: add word for deleting cached staging images. > command-line: save the executable in a variable so that people don't use (command-line) directly if possible. > bootstrap: fix this use of (command-line). > tools.deploy.shaker: set the rest of the args to preserve current behavior. > vm: store full command-line including executable first argument. > gopher: fix bug where empty lines weren't printed properly in menus. > gopher: simplify. > gopher: change gopher-text to use split1. > io.encodings.detect: simplify prolog-tag. > gopher: add way to get result without converting to objects. > tools.disassembler: allow disassemble of compose and curry. * vendor/grammars/fsharpbinding af755c8...d097476 (24): > Merge pull request #909 from cbowdon/issue877-vim-73-support > Merge pull request #913 from 7sharp9/Move_GetColourizations_toBg > Merge pull request #912 from 7sharp9/TryFind_opt > Merge pull request #911 from 7sharp9/FoldingParser > Merge pull request #908 from 7sharp9/TooltipOverhaul_AutoParamFix > Merge pull request #907 from 7sharp9/Movegetdefinestomodule > Merge pull request #906 from 7sharp9/tooltipfixforclosures > Merge pull request #905 from 7sharp9/ResolverProvider_singletimeout > Merge pull request #904 from fsharp/revert-903-ResolverProvider_singletimeout > Merge pull request #903 from 7sharp9/ResolverProvider_singletimeout > Merge pull request #902 from 7sharp9/ParameterCompletion_gatherTimeout > Merge pull request #901 from 7sharp9/Changed_invalidate_project > Merge pull request #900 from 7sharp9/Syntaxmode_removeextraoperation > Merge pull request #899 from 7sharp9/tooltips_ensureTimout > Merge pull request #898 from 7sharp9/pathextension_useAddRange > Merge pull request #897 from 7sharp9/resolverprovider_ensuretimout > Merge pull request #896 from 7sharp9/completion_ensuretimout > Merge pull request #895 from cbowdon/894-Vim-fix-for-no-completions-stacktrace > Merge pull request #890 from wangzq/gotodecl > Merge pull request #893 from 7sharp9/fixfortooltipvaltypes > Merge pull request #892 from 7sharp9/fixforprojecttypechecking > Added correct indentation > Merge pull request #891 from 7sharp9/ImproveImplementInterface > Merge pull request #888 from VincentDondain/master * vendor/grammars/haxe-sublime-bundle 58cad47...e2613bb (4): > fixed goto definition / find type > clean > adaptations for toplevel completion > first test * vendor/grammars/language-gfm c6df027...7b62290 (7): > Prepare 0.59.0 release > scoped-properties -> settings > Prepare 0.58.0 release > Merge pull request #67 from davidcelis/master > Prepare 0.57.0 release > Prepare 0.56.0 release > Merge pull request #64 from atom/mb-new-cpp-scope-name * vendor/grammars/language-javascript 15dc5d1...6690feb (5): > Prepare 0.52.0 release > Merge pull request #82 from Hurtak/feature/snippets-for > Merge pull request #80 from Hurtak/feature/snippets-querySelector > Merge pull request #79 from Hurtak/feature/snippets-switch-indentation-fix > Merge pull request #81 from Hurtak/feature/snippets-iife * vendor/grammars/language-python 476a353...f518e49 (5): > Prepare 0.28.0 release > Use trailing scope name > Merge pull request #48 from msabramo/patch-1 > Prepare 0.27.0 release > Add pattern for nonlocal keyword * vendor/grammars/language-sass 064a8b5...33efa33 (2): > Prepare 0.29.0 release > Allow + and - in selector argument * vendor/grammars/language-shellscript e2d62af...cbec163 (2): > Prepare 0.11.0 release > Merge pull request #4 from hd-deman/patch-1 * vendor/grammars/latex.tmbundle 682c4b7...52b2251 (42): > Replaced `python` with `python2.7` in shebangs > Make the preferences compatible with Python 3 > Handle manual spacing in “Reformat” (Table) > Fix: Reformatting of table containing empty cells > Use more descriptive variable names in `format` > Add documentation to `reformat` > Fix doctest in `refresh_viewer` > Add tests for `reformat` > Ignore “exit discard” status in `cramtests` > Remove print statements from `reformat` function > Fix: Close log window option ignored > Automatically scroll to bottom in “HTML Output” > Handle “\” signs in the notification window > Fix missing logname in default error message > Extend list of auxiliary files > Remove unused code from `latex_watch` > Display default message in notification window > Sort error messages by line number > Do not store duplicate error messages anymore > Close notification window on cleanup > Improve reopening of closed notification windows > Improve rewrap code in `texparser` > Improve readability of verbose log output > Only parse log file if there were changes > Remove unnecessary function call in “LaTeX Watch” > Properly close file in `guess_tex_engine` > Handle log messages containing double quotes > Left justify severity in notification window > Handle manual closing of notification window > Add additional information to notification window > Remove unused code from `texparser` > Close notification when typesetting succeeds > Add support for notifications to “LaTeX Watch” > Update bundle preference values instantly > Make “Reformat” (Table) compatible with Ruby 2 > Ignore escaped ampersand `\&` in “Format” (Table) > Remove warnings reported by `RuboCop` > Format code for “Reformat” (Table) > Move code for “Reformat” into separate script > Save “Reformat” command with TextMate 2 > Remove unused import > Use explicit import in “Itemize Lines In Selection” * vendor/grammars/mercury-tmlanguage b5a4fd6...eaef0b0 (8): > Add require_* and some, all keywords > Highlight %f format specifiers, `` as op > Correct implementation of '''', """" and 0'<char> > README.md: Mention GitHub grammar compatability > README.md: add resources and demonstration > reformatted whitespace; added foreign mods; missing keywords > Highlight variables, determ decls, more pragmas > no highlighting of variables, function names, type names, inst's, etc. * vendor/grammars/sublime-mask 2f59519...632ff3c (4): > v0.8.7 > v0.8.7 > + expression in component nodes < v0.8.6 * vendor/grammars/swift.tmbundle 81a0164...3c7eac5 (9): > Use constant scope for booleans > Use storage scope instead of keyword > Correct typo in include > Revamp string literal matching > Improve punctuation scopes > Allow for functions without a body > Add simple folding markers for swift > Improved matching of capture specifiers > Add Support for UInt, Int[8|16|32|64] & Float80
This was performed via `git submodule update --remote`. * vendor/grammars/Agda.tmbundle 784f435...68a218c (1): > Merge pull request github-linguist#1 from aroben/patch-1 * vendor/grammars/IDL-Syntax 9473b7f...3baeaea (1): > Merge pull request github-linguist#3 from aroben/patch-1 * vendor/grammars/NimLime 7a2fb4e...9cef4b6 (4): > Updated command names > Updated generated documentation > renamed more from nimrod to nim > Renamed several files * vendor/grammars/SCSS.tmbundle d6188e5...4147502 (1): > Merge pull request github-linguist#181 from redgluten/master * vendor/grammars/Sublime-VimL 6ab7e19...366fdc6 (1): > Merge pull request github-linguist#2 from yous/fix-single-quoted-string * vendor/grammars/factor 2dc5590...2453a78 (38): > json.writer: make sure we make hex values two digits zero padded. > json.writer: support escaping unicode > 0x10000. Thanks @jonenst! > mason.git: fix status check. > compiler.cfg.*: new unit test vocabs > compiler.cfg.*: more docs > compiler.cfg.*: refactoring away the compute-global-sets word > compiler.cfg.*: docs and more tests > compiler.cfg.stacks.local: refactoring making stack-changes and height-changes take and return stuff instead of using variables and the make building > compiler.cfg.parallel-copy: docs > compiler.cfg.stacks.height: these words are unused > compiler.cfg.*: more compiler docs > compiler.cfg.stacks.finalize: initial docs > io.launcher: fix stack effects. > io.launcher: fix docs for with-process-reader and with-process-writer. > io.launcher: add versions of with-process that preserve process and status. > mason.git: fix use. > mason.git: fix for rename. > io.launcher: cleanup public interface, make some things private or internal. > gopher: set 1 minute timeout by default. > brainfuck: cleanup tests. > json.writer: don't escape spaces, thats weird. > unix: some using cleanups. > python: rename startup/shutdown hooks. > math.extras: adding the Möbius function. > alien.c-types: move definitions of stdint.h from unix.types. > gopher: use contents now that it works. > io.ports: Make buffered-port not have a length because of Linux virtual files and TCP sockets. Related to issues github-linguist#1256 and github-linguist#1259. > tools.deploy.backend: add word for deleting cached staging images. > command-line: save the executable in a variable so that people don't use (command-line) directly if possible. > bootstrap: fix this use of (command-line). > tools.deploy.shaker: set the rest of the args to preserve current behavior. > vm: store full command-line including executable first argument. > gopher: fix bug where empty lines weren't printed properly in menus. > gopher: simplify. > gopher: change gopher-text to use split1. > io.encodings.detect: simplify prolog-tag. > gopher: add way to get result without converting to objects. > tools.disassembler: allow disassemble of compose and curry. * vendor/grammars/fsharpbinding af755c8...d097476 (24): > Merge pull request github-linguist#909 from cbowdon/issue877-vim-73-support > Merge pull request github-linguist#913 from 7sharp9/Move_GetColourizations_toBg > Merge pull request github-linguist#912 from 7sharp9/TryFind_opt > Merge pull request github-linguist#911 from 7sharp9/FoldingParser > Merge pull request github-linguist#908 from 7sharp9/TooltipOverhaul_AutoParamFix > Merge pull request github-linguist#907 from 7sharp9/Movegetdefinestomodule > Merge pull request github-linguist#906 from 7sharp9/tooltipfixforclosures > Merge pull request github-linguist#905 from 7sharp9/ResolverProvider_singletimeout > Merge pull request github-linguist#904 from fsharp/revert-903-ResolverProvider_singletimeout > Merge pull request github-linguist#903 from 7sharp9/ResolverProvider_singletimeout > Merge pull request github-linguist#902 from 7sharp9/ParameterCompletion_gatherTimeout > Merge pull request github-linguist#901 from 7sharp9/Changed_invalidate_project > Merge pull request github-linguist#900 from 7sharp9/Syntaxmode_removeextraoperation > Merge pull request github-linguist#899 from 7sharp9/tooltips_ensureTimout > Merge pull request github-linguist#898 from 7sharp9/pathextension_useAddRange > Merge pull request github-linguist#897 from 7sharp9/resolverprovider_ensuretimout > Merge pull request github-linguist#896 from 7sharp9/completion_ensuretimout > Merge pull request github-linguist#895 from cbowdon/894-Vim-fix-for-no-completions-stacktrace > Merge pull request github-linguist#890 from wangzq/gotodecl > Merge pull request github-linguist#893 from 7sharp9/fixfortooltipvaltypes > Merge pull request github-linguist#892 from 7sharp9/fixforprojecttypechecking > Added correct indentation > Merge pull request github-linguist#891 from 7sharp9/ImproveImplementInterface > Merge pull request github-linguist#888 from VincentDondain/master * vendor/grammars/haxe-sublime-bundle 58cad47...e2613bb (4): > fixed goto definition / find type > clean > adaptations for toplevel completion > first test * vendor/grammars/language-gfm c6df027...7b62290 (7): > Prepare 0.59.0 release > scoped-properties -> settings > Prepare 0.58.0 release > Merge pull request github-linguist#67 from davidcelis/master > Prepare 0.57.0 release > Prepare 0.56.0 release > Merge pull request github-linguist#64 from atom/mb-new-cpp-scope-name * vendor/grammars/language-javascript 15dc5d1...6690feb (5): > Prepare 0.52.0 release > Merge pull request github-linguist#82 from Hurtak/feature/snippets-for > Merge pull request github-linguist#80 from Hurtak/feature/snippets-querySelector > Merge pull request github-linguist#79 from Hurtak/feature/snippets-switch-indentation-fix > Merge pull request github-linguist#81 from Hurtak/feature/snippets-iife * vendor/grammars/language-python 476a353...f518e49 (5): > Prepare 0.28.0 release > Use trailing scope name > Merge pull request github-linguist#48 from msabramo/patch-1 > Prepare 0.27.0 release > Add pattern for nonlocal keyword * vendor/grammars/language-sass 064a8b5...33efa33 (2): > Prepare 0.29.0 release > Allow + and - in selector argument * vendor/grammars/language-shellscript e2d62af...cbec163 (2): > Prepare 0.11.0 release > Merge pull request github-linguist#4 from hd-deman/patch-1 * vendor/grammars/latex.tmbundle 682c4b7...52b2251 (42): > Replaced `python` with `python2.7` in shebangs > Make the preferences compatible with Python 3 > Handle manual spacing in “Reformat” (Table) > Fix: Reformatting of table containing empty cells > Use more descriptive variable names in `format` > Add documentation to `reformat` > Fix doctest in `refresh_viewer` > Add tests for `reformat` > Ignore “exit discard” status in `cramtests` > Remove print statements from `reformat` function > Fix: Close log window option ignored > Automatically scroll to bottom in “HTML Output” > Handle “\” signs in the notification window > Fix missing logname in default error message > Extend list of auxiliary files > Remove unused code from `latex_watch` > Display default message in notification window > Sort error messages by line number > Do not store duplicate error messages anymore > Close notification window on cleanup > Improve reopening of closed notification windows > Improve rewrap code in `texparser` > Improve readability of verbose log output > Only parse log file if there were changes > Remove unnecessary function call in “LaTeX Watch” > Properly close file in `guess_tex_engine` > Handle log messages containing double quotes > Left justify severity in notification window > Handle manual closing of notification window > Add additional information to notification window > Remove unused code from `texparser` > Close notification when typesetting succeeds > Add support for notifications to “LaTeX Watch” > Update bundle preference values instantly > Make “Reformat” (Table) compatible with Ruby 2 > Ignore escaped ampersand `\&` in “Format” (Table) > Remove warnings reported by `RuboCop` > Format code for “Reformat” (Table) > Move code for “Reformat” into separate script > Save “Reformat” command with TextMate 2 > Remove unused import > Use explicit import in “Itemize Lines In Selection” * vendor/grammars/mercury-tmlanguage b5a4fd6...eaef0b0 (8): > Add require_* and some, all keywords > Highlight %f format specifiers, `` as op > Correct implementation of '''', """" and 0'<char> > README.md: Mention GitHub grammar compatability > README.md: add resources and demonstration > reformatted whitespace; added foreign mods; missing keywords > Highlight variables, determ decls, more pragmas > no highlighting of variables, function names, type names, inst's, etc. * vendor/grammars/sublime-mask 2f59519...632ff3c (4): > v0.8.7 > v0.8.7 > + expression in component nodes < v0.8.6 * vendor/grammars/swift.tmbundle 81a0164...3c7eac5 (9): > Use constant scope for booleans > Use storage scope instead of keyword > Correct typo in include > Revamp string literal matching > Improve punctuation scopes > Allow for functions without a body > Add simple folding markers for swift > Improved matching of capture specifiers > Add Support for UInt, Int[8|16|32|64] & Float80
Add some more Perl 6 examples so the classifier does a better job.