David Korn schrieb:
Subject: Re: [ast-developers] Parse error in type definition
--------
Here is another problem:
typeset -T A_t=(
xxx
function f
{
(( n = 0 ))
}
)
This produces the error message
t: syntax error at line 6: `((' unexpected
The error occurs if xxx is a normal (non-declaration) statement, and
also, unfortunately, in some cases where xxx is a user-defined type in a
file xxx reachable via FPATH.
If 'function f' is replaced by 'f()', the message changes to
t: syntax error at line 4: `(' unexpected
The shell is processing
(...)
as a compound command and since the first token is not a typename or
a declaration command or a function definition, it assumes that
it is an array assignment. If fails when it finds the first token
that would make it an invalid array assignment.
However, since an array assignment is not valid for a type definition,
I added another state to the parser so that it produces an error if
the first token is not valid.
I now get:
syntax error at line 2: `xxx' unexpected
in both cases.
Hm, there still appears to be a glitch in the parser, as
typeset -T A_t=(
integer -a arr
function f
{
(( _.arr[0] = 0 ))
print ${_.arr[*]}
}
)
A_t x
prints:
A_t: _.arr[0] = 0 : arithmetic syntax error
(with version 2008-10-01). It works, however, if the assignment is
replaced by
_.arr[0]=0
Regards,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers