From 6e7f4158ec38464c706cc28abcb82423122f2cf8 Mon Sep 17 00:00:00 2001 From: Steve Donovan Date: Mon, 22 Aug 2016 13:04:28 +0200 Subject: [PATCH] Issue #248 standalone field considered a parse error; reset is_local after parse_error set --- ldoc/parse.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ldoc/parse.lua b/ldoc/parse.lua index 6df6668..29672dc 100644 --- a/ldoc/parse.lua +++ b/ldoc/parse.lua @@ -293,7 +293,10 @@ local function parse_file(fname, lang, package, args) first_comment = false else item_follows, is_local, case = lang:item_follows(t,v,tok) - if not item_follows then parse_error = is_local end + if not item_follows then + is_local = false + parse_error = is_local + end end if item_follows or comment_contains_tags(comment,args) then tags = extract_tags(comment,args) @@ -322,6 +325,7 @@ local function parse_file(fname, lang, package, args) doc.expand_annotation_item(tags,current_item) -- if the item has an explicit name or defined meaning -- then don't continue to do any code analysis! + local field_or_param = (tags.field or tags.param) and not tags.class if tags.name then if not tags.class then F:warning("no type specified, assuming function: '"..tags.name.."'") @@ -346,7 +350,10 @@ local function parse_file(fname, lang, package, args) ldoc_comment = false end end - elseif parse_error then + -- Watch out for the case where there are field or param tags + -- but no class, since these will be fixed up later as module/class + -- entities + elseif parse_error and not field_or_param then F:warning('definition cannot be parsed - '..parse_error) end end