<commit_before># @oigroup/babylon-lightscript

> NB: This is a fork of babylon-lightscript which implements language changes that are not necessarily endorsed by upstream. Generally speaking, our intent is to closely follow the upstream language -- however, there may be notable deviations which are documented below.

The parser for [LightScript](http://lightscript.org).
To be used with [@oigroup/babel-plugin-lightscript](https://github.com/wcjohnson/babel-plugin-lightscript).

A minimally-invasive fork of [Babylon](https://github.com/babel/babylon).
With the exception of a few reserved keywords,
it parses JS as JS unless the `"lightscript"` plugin is passed.

### Contributing

    yarn
    npm run build
    npm test

New tests should go in the
[lightscript](https://github.com/lightscript/babylon-lightscript/tree/lightscript/test/fixtures/lightscript)
directory.

### Deviations from LightScript proper

#### If Statements and Expressions

(See https://github.com/wcjohnson/babylon-lightscript/issues/2)

`@oigroup/babylon-lightscript` enforces consistent syntax between if statements and if expressions, so that programmers don't encounter land mines when switching between the two. In practical terms, this means:

1. This is now illegal syntax:
```js
if a: {x} else b
```
If you use colon syntax on one clause of an `if` you must use it on all clauses.

2. This is now legal syntax:
```js
y = if(three()) 3 else 4
```
Traditional JavaScript `if` syntax now works with `if` expressions (as it should, since it works for `if` statements).<commit_msg>Readme cleanup<commit_after># @oigroup/babylon-lightscript

> NB: This is a fork of babylon-lightscript which implements language changes that are not necessarily endorsed by upstream. Generally speaking, our intent is to closely follow the upstream language -- however, there may be notable deviations which are documented below.

The parser for [LightScript](http://lightscript.org).
To be used with [@oigroup/babel-plugin-lightscript](https://github.com/wcjohnson/babel-plugin-lightscript).

A minimally-invasive fork of [Babylon](https://github.com/babel/babylon).
With the exception of a few reserved keywords,
it parses JS as JS unless the `"lightscript"` plugin is passed.

### Contributing

    yarn
    npm run build
    npm test

New tests should go in the
[lightscript](https://github.com/lightscript/babylon-lightscript/tree/lightscript/test/fixtures/lightscript)
directory.

### Deviations from LightScript proper

#### If Statements and Expressions

(See https://github.com/wcjohnson/babylon-lightscript/issues/2)

`@oigroup/babylon-lightscript` enforces consistent syntax between if statements and if expressions, so that programmers don't encounter land mines when switching between the two. In practical terms, this means:

**This is now illegal syntax:**
```js
if a: {x} else b
```
If you use colon syntax on one clause of an `if` you must use it on all clauses.

**This is now legal syntax:**
```js
y = if(three()) 3 else 4
```
Traditional JavaScript `if` syntax now works with `if` expressions (as it should, since it works for `if` statements).
{'fraction_non_alphanumeric': 0.0946594179724976, 'fraction_numerical': 0.0025583626479053407, 'mean_word_length': 4.728937728937729, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '437180', 'n_tokens_mistral': 921, 'n_tokens_neox': 844, 'n_words': 370}