update docs, add tests

This commit is contained in:
rolux 2012-05-26 13:02:50 +02:00
parent e081f5b0ee
commit 6b12776ed9

View file

@ -18,11 +18,7 @@ Ox.doc <f> Generates documentation for annotated JavaScript
<code>"event"</code>, <code>"function"</code>
or <code>"object"</code>.
section <s|u> Section in the file
source <[o]> Source code (array of tokens)
length <n> Length of the token
offset <n> Offset of the token
type <s> Type of the token
See Ox.tokenize for list of types
source <s> Source code
summary <s> One-line summary
usage <[o]> Usage (array of doc objects)
Present if the <code>type</code> of the item is
@ -38,7 +34,6 @@ Ox.doc <f> Generates documentation for annotated JavaScript
# > Ox.doc("//@ My.FOO <n> Magic constant\nMy.FOO = 23;")
# [{"name": "Ox.foo", "summary": "just some string", "type": "string"}]
@*/
Ox.doc = (function() {
// fixme: dont require the trailing '@'
var re = {
@ -585,6 +580,10 @@ Ox.tokenize <f> Tokenizes JavaScript
<code>"string"</code> or <code>"whitespace"</code>
value <s> Value of the token
source <s> JavaScript source code
> Ox.tokenize('// comment\nvar foo = bar / baz;').length
14
> Ox.tokenize('return /foo/g;')[2].value.length
6
@*/
// FIXME: numbers (hex, exp, etc.)
Ox.tokenize = (function() {