Codebase list lua-ldoc / d7ee2d8
no longer an error for @function to have modifiers (#45), although we're not yet passing it through. New @static tag for class methods steve donovan 11 years ago
2 changed file(s) with 22 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
2424 class = 'id', name = 'id', pragma = 'id', alias = 'id', within = 'id',
2525 copyright = 'S', summary = 'S', description = 'S', release = 'S', license = 'S',
2626 fixme = 'S', todo = 'S', warning = 'S', raise = 'S',
27 ['local'] = 'N', export = 'N', private = 'N', constructor = 'N';
27 ['local'] = 'N', export = 'N', private = 'N', constructor = 'N', static = 'N';
2828 -- project-level
2929 module = 'T', script = 'T', example = 'T', topic = 'T', submodule='T',
3030 -- module-level
301301 if doc.class_tag(stype) then
302302 if not item.name:match '[:%.]' then -- not qualified
303303 local class = this_section.name
304 item.name = class..(not item.tags.constructor and ':' or '.')..item.name
304 local static = item.tags.constructor or item.tags.static
305 item.name = class..(not static and ':' or '.')..item.name
305306 end
306307 if stype == 'factory' then
307308 if item.tags.private then to_be_removed = true
374375 for tag in iter(tags) do
375376 self:set_tag(tag,tags[tag])
376377 end
377 --for tag,value in pairs(tags) do print('tag',tag,value) end
378378 end
379379
380380 function Item:add_to_description (rest)
398398 end
399399 self.tags[tag] = value
400400 elseif ttype == TAG_ID then
401 --print('id',tag,value)
402 if type(value) ~= 'string' then
403 -- such tags are _not_ multiple, e.g. name
404 self:error("'"..tag.."' cannot have multiple values")
405 else
406 local id, rest = tools.extract_identifier(value)
407 self.tags[tag] = id
408 self:add_to_description(rest)
409 end
401 if type(value) == 'table' then
402 if value.append then -- it was a List!
403 -- such tags are _not_ multiple, e.g. name
404 self:error("'"..tag.."' cannot have multiple values")
405 end
406 value = value[1]
407 end
408 local id, rest = tools.extract_identifier(value)
409 self.tags[tag] = id
410 self:add_to_description(rest)
410411 elseif ttype == TAG_SINGLE then
411412 self.tags[tag] = value
412413 elseif ttype == TAG_FLAG then
2323 function Vector.new (t)
2424 end
2525
26 -- note that @function may have modifiers. Currently
27 -- we aren't doing anything with them, but LDoc no longer
28 -- complains (issue #45). Note also that one needs
29 -- explicit @param tags with explicit @function; 'static'
30 -- methods must have a @constructor or a @static tag.
31
2632 ----------
2733 -- Create a vector from a string.
2834 -- @usage
2935 -- v = Vector.parse '[1,2,3]'
3036 -- assert (v == Vector.new {1,2,3})
37 -- @function[kind=ctor] parse
38 -- @static
39 -- @param s
3140 function Vector.parse (s)
3241 end
3342