1. Reposting : small bug in euphoria parsing



-- demo a tiny bug where Eu parsing breaks.
-- If "trace" is coded between the procedure declaration and the
-- first private variables, ie immediately after the proc dcl.
-- error is "Syntax error - expected to see possibly 'end', not a type"
-- Euphoria v2.5
-- workaround is to put the trace(1) after the variables declarations
--
with trace
procedure main()
      trace(1)
      integer i1
      i1 = 0
      i1 = i1 + 1
end procedure

main()


Sorry for the out-of-order post, my original did not get through

new topic     » topic index » view message » categorize

2. Re: Reposting : small bug in euphoria parsing

Alan Oxley wrote:
> }}}
<eucode>
> -- demo a tiny bug where Eu parsing breaks.
> -- If "trace" is coded between the procedure declaration and the
> -- first private variables, ie immediately after the proc dcl.
> -- error is "Syntax error - expected to see possibly 'end', not a type"
> -- Euphoria v2.5
> -- workaround is to put the trace(1) after the variables declarations
> --
> with trace
> procedure main()
>       trace(1)
>       integer i1
>       i1 = 0
>       i1 = i1 + 1
> end procedure
> 
> main()
> </eucode>
{{{


Refman Section 2.4.2:
 "Variable declarations inside a subroutine must all appear at the 
  beginning, before the executable statements of the subroutine."

It says it expected to see possibly 'end', since that is
one possible keyword that could legally follow a trace statement
inside a routine.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Reposting : small bug in euphoria parsing

Alan Oxley wrote:
> 
> }}}
<eucode>
> -- demo a tiny bug where Eu parsing breaks.
> -- If "trace" is coded between the procedure declaration and the
> -- first private variables, ie immediately after the proc dcl.
> -- error is "Syntax error - expected to see possibly 'end', not a type"
> -- Euphoria v2.5
> -- workaround is to put the trace(1) after the variables declarations
> --
> with trace
> procedure main()
>       trace(1)
>       integer i1
>       i1 = 0
>       i1 = i1 + 1
> end procedure
> 
> main()
> </eucode>
{{{

> 
> Sorry for the out-of-order post, my original did not get through

I thought that was a bug too, but it's just the way Euphoria works.
Routine scoped variables must be declared at the very beginning of a routine
block.

Try this:

with trace
procedure main()
    integer i1
    trace(1)
    i1 = 0
    i1 += 1
end procedure

main()


Regards,
Vincent

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu