Lit is a multilanguage syntax highlighter written in PHP. It takes code as input and returns an HTML pre element containing the code highlighted using span elements with classes based upon tokens in the code. It is loosely based upon [Atom][a]'s [Highlights][b] which is used in the Atom text editor to syntax highlight code. Atom's Highlights is in turn based upon [TextMate][c]'s syntax highlighting using its concepts of scope selectors and common keywords for components of programming languages. Lit is not a port of Atom's Highlights but instead an independent implementation of what I can understand of TextMate's grammar syntax, parsing, and tokenization by analyzing other implementations. It aims to at least have feature parity or better with Atom's Highlights.
In normal usage of the library the parameters won't be used (see `dW\Lit\Grammar::loadJSON` and examples below for more information), but they are listed below for completeness' sake.
***scopeName*** - The scope name of the grammar
***patterns*** - The list of patterns in the grammar
***name*** - A human-readable name for the grammar
***injections*** - The list of injections in the grammar
***repository*** - The list of repository items in the grammar
### dW\\Lit\\Grammar::loadJSON ###
Imports an Atom JSON grammar into the `dW\Lit\Grammar` object.
```php
public function dW\Lit\Grammar::loadJSON(string $filename)
***scopeName*** - The scope name (eg: text.html.php) of the grammar that's needed to highlight the input data
***document*** - An existing `DOMDocument` to use as the owner document of the returned `DOMElement`; if omitted one will be created instead
***encoding*** - The encoding of the input data string; only used if a document wasn't provided in the previous parameter, otherwise it uses the encoding of the existing `DOMDocument`; defaults to HTML standard default windows-1252