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> <code>"event"</code>, <code>"function"</code>
or <code>"object"</code>. or <code>"object"</code>.
section <s|u> Section in the file section <s|u> Section in the file
source <[o]> Source code (array of tokens) source <s> Source code
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
summary <s> One-line summary summary <s> One-line summary
usage <[o]> Usage (array of doc objects) usage <[o]> Usage (array of doc objects)
Present if the <code>type</code> of the item is 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;") # > Ox.doc("//@ My.FOO <n> Magic constant\nMy.FOO = 23;")
# [{"name": "Ox.foo", "summary": "just some string", "type": "string"}] # [{"name": "Ox.foo", "summary": "just some string", "type": "string"}]
@*/ @*/
Ox.doc = (function() { Ox.doc = (function() {
// fixme: dont require the trailing '@' // fixme: dont require the trailing '@'
var re = { var re = {
@ -585,6 +580,10 @@ Ox.tokenize <f> Tokenizes JavaScript
<code>"string"</code> or <code>"whitespace"</code> <code>"string"</code> or <code>"whitespace"</code>
value <s> Value of the token value <s> Value of the token
source <s> JavaScript source code 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.) // FIXME: numbers (hex, exp, etc.)
Ox.tokenize = (function() { Ox.tokenize = (function() {