Skip to content

Commit

Permalink
Merge pull request #96 from sumanstats/master
Browse files Browse the repository at this point in the history
Reflect Raku rename
  • Loading branch information
JJ authored Oct 17, 2020
2 parents 8bd7b16 + a806f93 commit e7ade21
Show file tree
Hide file tree
Showing 17 changed files with 1,433 additions and 1,437 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREDITS linguist-language=Perl6
CREDITS linguist-language=Raku
28 changes: 14 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This will install and link to the folder you just cloned. Now you are ready to
start hacking away!

### The issue tracker and you
For the purposes of this project, a *bug* is anything which alters the
For the purpose of this project, a *bug* is anything which alters the
highlighting of surrounding text. An *issue* is anything that highlighting
currently works on, but fails to work in some conditions.
Anything else is an *enhancement* .
Expand Down Expand Up @@ -71,11 +71,11 @@ Because of this, a priority system is the best way to categorize any issues.
### Escaping
**Important escaping is very easy to mess up. Use the included scripts to get to an unescaped version, edit on that one, and then escape it again**

* The best thing to use when editing is use `dev/escape.p6` or `dev/unescape.p6` to unescape or escape text. These scripts accept STDIN and output an escaped/unescaped version.
* The best thing to use when editing is use `dev/escape.raku` or `dev/unescape.raku` to escape or unescape text. These scripts accept STDIN and output an escaped/unescaped version.

* I usually copy the text `xclip -o | dev/unescape.p6` work on the text and then copy back and do`xclip -o | dev/escape.p6`
* I usually copy the text `xclip -o | dev/unescape.raku` work on the text and then copy back and do`xclip -o | dev/escape.raku`

* (though often I do `xclip -o | dev/Xescape.p6 | xclip` and it lands right back on the clipboard but in a differently escaped version. This will prevent accidents with the escaping which are very easy to do (can cause silent bugs or worse).
* (though often I do `xclip -o | dev/Xescape.raku | xclip` and it lands right back on the clipboard but in a differently escaped version. This will prevent accidents with the escaping which are very easy to do (can cause silent bugs or worse).

### Oniguruma Regex Engine
* The Oniguruma regex engine is used by all programs which utilize
Expand All @@ -84,8 +84,8 @@ Because of this, a priority system is the best way to categorize any issues.
`\\x{20}` (Unescaped form: `\x{20}`).
This will use the Regex engine for this instead of using the JSON/CSON method
of noting unicode codepoints (e.g. `\u20` which can be used in CSON/JSON).
* Specify Unicode propertys like this: `\\p{Alpha}`(`\p{Alpha}` in unescaped
form). See the cheatsheet linked below for all the ones that are guarenteed
* Specify Unicode properties like this: `\\p{Alpha}`(`\p{Alpha}` in unescaped
form). See the cheatsheet linked below for all the ones that are guaranteed
to work.


Expand Down Expand Up @@ -113,7 +113,7 @@ sections of the code with `'include': '#identifier_name'`.
The simplest for is ‘match’ which will only match at most against one line.

`'match': 'regex goes here'
'name': 'label.perl6fe'`
'name': 'label.raku'`

When you specify a name for the match, this label gets applied to the entire
match of the regex. If you need to apply multiple labels, you should use
Expand All @@ -131,20 +131,20 @@ on top of the previous ones. You list the subrules in the Patterns section
of the rule you are working on.

### Show me the source already!
The majority of the grammar is included in `grammars/perl6fe.cson`.
The majority of the grammar is included in `grammars/raku.cson`.
The `q[]`, `qq[]`, `Q[]`, `"…"` etc. quoting is generated by
`dev/q-qq-Q-template.p6`. Multi-line comments are also generated. The q
types of quoting are added to `perl6fe.quoting.cson`. The standard quotation
marks are added to `perl6fe.cson`.
`dev/q-qq-Q-template.raku`. Multi-line comments are also generated. The q
types of quoting are added to `raku.quoting.cson`. The standard quotation
marks are added to `raku.cson`.

Once you have edited `q-qq-Q-template.p6`, run `dev/replace.sh` which uses
awk to do the replacement. Eventually it will be nice if we had a purely Perl 6
Once you have edited `q-qq-Q-template.raku`, run `dev/replace.sh` which uses
awk to do the replacement. Eventually it will be nice if we had a purely Raku
solution.

### Testing
We all love tests, right? To run tests, run `apm test` and the tests will run.

The testing file is at `spec/grammar-perl6fe-spec.coffee`. Please make sure
The testing file is at `spec/grammar-raku-spec.coffee`. Please make sure
when adding a test, that you are able to make the test fail by altering the
values of the expected response. Syntax problems can cause tests to succeed
silently.
Expand Down
4 changes: 2 additions & 2 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
> Describe what you see, what you want to see, and perhaps some linkage to docs, synopses, or irclog chatter.
### Example Code
```perl6
```raku

```
### Picture [optional]
> Providing a picture means that if the issue is fixed and linguist updates to include the fix (linguist uses this package to highlight Raku/Perl 6 on GitHub), your issue will remain historically viewable.
> Providing a picture means that if the issue is fixed and linguist updates to include the fix (linguist uses this package to highlight Raku on GitHub), your issue will remain historically viewable.
### Leave this in. For internal use.
- [ ] Fixed in Master
Expand Down
32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[script-package]: https://atom.io/packages/script
[mit]: http://opensource.org/licenses/MIT
[author]: http://github.com/perl6
[author]: http://github.com/Raku
[releases]: https://github.com/perl6/atom-language-perl6/releases
[mit-badge]: https://img.shields.io/apm/l/language-perl6.svg
[apm-pkg-link]: https://atom.io/packages/language-perl6
Expand All @@ -16,41 +16,38 @@
[fira-code]: https://github.com/tonsky/FiraCode
[screenshot-1]: https://raw.githubusercontent.com/perl6/atom-language-perl6/master/images/example1.png

# Atom Raku/Perl 6 Support - »ö« Official Edition!
# Atom Raku Support - »ö« Official Edition!

[![apm package][apm-ver-link]][apm-pkg-link]
[![][dl-badge]][apm-pkg-link]
[![][mit-badge]][mit]
[![travis][travis-badge]][travis-link]

A colorful, thoughtful, and helpful language grammar for Perl 6! See
A colorful, thoughtful, and helpful language grammar for Raku! See
[here](#how-do-i-use-this) for questions about usage.

![A screenshot of an funnified Raku/Perl 6 file][screenshot-1]
![A screenshot of an funnified Raku file][screenshot-1]

## Integration
This package has integration with the Atom [script][script-package] package.
With both this package and the `script` package you can execute
highlighted Raku/Perl 6 code or the whole document, even if it hasn't been saved using
highlighted Raku code or the whole document, even if it hasn't been saved using
a keyboard shortcut.

## What Makes This The *Fun* Edition?

> Perl 6 (Raku) is optimized for fun. ― Audrey Tang
> Raku is optimized for fun. ― Audrey Tang
* This package was designed to work with [Fira Code][fira-code] ligatures

* Much more syntax highlighted (numbers, operators, interpolation, traits, better strings).
* Much more syntax highlighted (numbers, operators, interpolation, traits, better strings)

* Some day we hope this package will also contain support for many popular
atom packages that have service hooks like autocomplete+ and linter
* Some day we hope this package will also contain support for many popular atom packages that have service hooks like autocomplete+ and linter


## See something? Say something!
See something highlighted incorrectly? See something LTA (Less Than Awesome)?
Please report it on the [issue tracker][issues]. Any issue no matter how small
should be reported. It is our hope that this is not only the best Raku/Perl 6
highlighter for Atom, but the best highlighter for Atom out there.
Please report it on the [issue tracker][issues]. Any issue no matter how small should be reported. It is our hope that this is not only the best Raku highlighter for Atom, but the best highlighter for Atom out there.

## Contributing
Contributions are welcome! Please see [`CONTRIBUTING.md`][contributing] for a tutorial on writing Atom syntax grammars and more information!
Expand All @@ -60,26 +57,23 @@ Integration with Autocomplete+, linter or other packages are possible future fea

## How do I use this?

This language grammar should automatically highlight `.p6`, `.pod6`, `.pm6` and
`.nqp` files. The language grammar will also detect files whose first
line includes `use v6`, a shebang whose last term before any whitespace is
`perl6` , `=begin pod`, or `my class`.
This language grammar should automatically highlight `.raku`, `.rakumod`, `.rakutest`, `.rakudoc`, `.nqp` and legacy `.p6`, `.pod6`, `.pm6` files. The language grammar will also detect files whose first line includes `use v6`, a shebang whose last term before any whitespace is `raku` , `=begin pod`, or `my class`.

If you are having issues, the `language-perl` package is probably taking
precedence. To remedy this you can:

* Click the language name in the status-bar (`Ctrl+Shift+L`) and select `Raku/Perl 6`
* Click the language name in the status-bar (`Ctrl+Shift+L`) and select `Raku`
* If you want to permanently change the preferences for a file type,
add the following to your `config.cson` (*Edit**Config*):

```coffee
"*":
core:
customFileTypes:
'source.perl6fe': [
'source.raku': [
'p6'
'pm6'
# Add pm and t if you want auto choose this highlighter for .pm or 't
# Add pm and t if you want auto choose this highlighter for .pm or .t
# files.
'pm'
't'
Expand Down
6 changes: 3 additions & 3 deletions dev/benchmark.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ fs = require 'fs-plus'
GrammarRegistry = require '../lib/grammar-registry'

registry = new GrammarRegistry()
p6Grammar = registry.loadGrammarSync(path.resolve(__dirname, '..', '..', 'atom-language-perl6', 'grammars', 'perl6fe.cson'))
p6Grammar.maxTokensPerLine = Infinity
RakuGrammar = registry.loadGrammarSync(path.resolve(__dirname, '..', '..', 'atom-language-perl6', 'grammars', 'raku.cson'))
RakuGrammar.maxTokensPerLine = Infinity

duration_tot = 0
tokenize = (grammar, content, lineCount) ->
Expand All @@ -29,6 +29,6 @@ TestFolder = path.resolve('benchmark', 'rakudo')
files = fs.readdirSync(TestFolder)
for file in files
console.log file
tokenizeFile(path.resolve('benchmark', 'rakudo', file), p6Grammar, "tokening #{file}")
tokenizeFile(path.resolve('benchmark', 'rakudo', file), RakuGrammar, "tokening #{file}")

console.log "Total time: #{duration_tot}ms"
2 changes: 1 addition & 1 deletion dev/escape.p6 → dev/escape.raku
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env perl6
#!/usr/bin/env raku
sub escape-cson ( $str is copy ) {
my @chars = <'>;
my $reverse-solidus = Q[\];
Expand Down
Loading

0 comments on commit e7ade21

Please sign in to comment.