mgalloy / idldoc

Documenting IDL code
Other
20 stars 13 forks source link

Problem parsing BEGIN with an extra $ after it #73

Closed mgalloy closed 11 years ago

mgalloy commented 11 years ago

Here is a minimal code example. Reported by Tom Grydeland on the newsgroup.

; ------------------ >8 -----------
;+
; One description
;-
pro one
    if 1 then begin $           ; remove the dollar on this line to restore sanity
        print, "hello, "
    endif
end 

;+
; This description (and everything from here on) disappears
;-
pro two
    print, " world!"
end 
mgalloy commented 11 years ago

The fix is in r846. The problem was that the "$" masked the "begin" so the "endif" made the parser think the routine was finished. Parser changed to not go down to code level zero except by "end", i.e., not "endfor", "endif", etc.

Who knows what rules the IDL parser is following here to make that syntax OK, but it compiles in IDL 8.2.1.