-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Consider the following named subroutine in a file nested.ngc:
osub
o100 sub
(DEBUG, #1 #2 #3)
o100 endsub
o100 call [4] [5] [6]
oendsub
M2
Now if you call this with this MDI command:
ocall [7] [8] [9]
One would expect the DEBUG popup to have "4 5 6" in it. However, it has "7 8 9" in it. FYI this cost me a probe tip :-P
If the o100 sub is before the osub, the parser doesn't see it at all and you get "EOF in nested.ngc seeking o-word".
If the o100 sub is after the oendsub, it functions correctly.
As far as I can tell, the o100 sub is ignored but the o100 endsub ends the osub - the rest of the file is ignored.
THE BUG IS:
- No errors are emitted if a nested sub is detected, or if a numbered sub comes before a named sub.
- The requirement that numbered subs follow named subs is not documented in the named sub docs, and only briefly hinted ("no nesting") in the o-call example. Those docs say "a subroutine may not be called until it is defined" but that isn't true for a numbered sub preceeding a named sub.
- The named sub docs say "A named subroutine file can contain only a single subroutine definition." but this excludes numbered subs, which seem to be supported, but must follow the named sub.
Reproduced with 2.8, 2.9, and 2.10.0-git
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels