Files
swift-mirror/utils/pygments
practicalswift 1cd4d4e9c9 [gardening] Fix violations of non-controversial PEP8 rules
Fixes:
* multiple statements on one line (colon) (E701)
* missing whitespace around arithmetic operator (E226)
* missing whitespace around operator (E225)
* closing bracket does not match visual indentation (E124)
* blank line contains whitespace (W293)
* continuation line missing indentation or outdented (E122)
* continuation line over-indented for hanging indent (E126)
* missing expected blank line (E301)
* trailing whitespace (W291)
* unexpected spaces around keyword / parameter equals (E251)
* whitespace after '(', '[' or '{' (E201)
* whitespace before ')', ']' or '}' (E202)
* whitespace before ',' or ':' (E203)
2016-01-23 09:23:33 +01:00
..

====================
Swift Pygments Lexer
====================

This is a hideous attempt to provide Pygments lexers for parsing both Swift and Swift REPL code listings. They are specifically tailored for code in the white paper.

The code is designed to be completely rewritten when someone has some free time. No programmers were hurt in the making of these lexers, but Python and Regular Expressions suffered grave losses.



Installation
============

**You don't need to install this file to use it with Sphinx** provided
you use a monkeypatch like the one in this project's docs/conf.py

Otherwise, in order to be made available to Pygments, you need to copy
the included `swift.py` file and run the Pygments `_mapping.py` config
script.

You'll need to find out the path to your Pygments install. For me, this was:
/Library/Python/2.7/site-packages/Pygments-1.6rc1-py2.7.egg/pygments/lexers

To find it:

    $ cd /Library/Python
    $ find . -name lexers

Copy the `swift.py` file to this directory.

Execute the Pygments config script:

    $ python _mapping.py

Usage
=====

For pure Swift code use the `swift` lexer, for REPL use `swift-console`.

The white paper is already marked up to use the Swift lexers.