Permalink
Browse files

Updated docs

  • Loading branch information...
1 parent cbf022d commit 5db5679979caafc5ca611431a046d78e899e2cb0 @rspivak committed May 2, 2011
View
@@ -0,0 +1,4 @@
+# Sphinx build info version 1
+# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
+config: 1b50d28db50b4b6a8d8b1fc7938c328d
+tags: fbb0d17656682115ca4d033fb2f83ba1
View
@@ -0,0 +1,66 @@
+.. SlimIt documentation master file, created by
+ sphinx-quickstart on Mon May 2 11:51:24 2011.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to SlimIt
+==================================
+
+`SlimIt` is a JavaScript minifier written in Python.
+It compiles JavaScript into more compact code so that it downloads
+and runs faster.
+
+As of version `0.1` it provides only a JavaScript lexer.
+
+Using lexer in your project
+---------------------------
+
+>>> from slimit.lexer import Lexer
+>>> lexer = Lexer()
+>>> lexer.input('a = 1;')
+>>> for token in lexer:
+... print token
+...
+LexToken(ID,'a',1,0)
+LexToken(EQ,'=',1,2)
+LexToken(NUMBER,'1',1,4)
+LexToken(SEMI,';',1,5)
+
+You can get one token at a time using ``token`` method:
+
+>>> lexer.input('a = 1;')
+>>> while True:
+... token = lexer.token()
+... if not token:
+... break
+... print token
+...
+LexToken(ID,'a',1,0)
+LexToken(EQ,'=',1,2)
+LexToken(NUMBER,'1',1,4)
+LexToken(SEMI,';',1,5)
+
+`LexToken` instance has different attributes:
+
+>>> lexer.input('a = 1;')
+>>> token = lexer.token()
+>>> token.type, token.value, token.lineno, token.lexpos
+('ID', 'a', 1, 0)
+
+Installation
+------------
+
+Using ``pip``::
+
+ $ sudo pip install slimit
+
+Using ``easy_install``::
+
+ $ sudo easy_install slimit
+
+
+.. toctree::
+ :maxdepth: 2
+
+
+
Oops, something went wrong.

0 comments on commit 5db5679

Please sign in to comment.