Hi gurus and nubys,
I wonder if this is related to the 1.8.4 one-click installer (preview)
or a general change in ruby: I’m getting really weird error messages for
syntax errors, it seem that ruby spits out some non-formatted names from
the parser code whe it encounters a syntax error.
Some examples:
def
t.rb:1: parse error, unexpected $
p() p
t.rb:1: parse error, unexpected tIDENTIFIER, expecting $
p(/)
t.rb:1: unterminated string meets end of file
t.rb:1: parse error, unexpected tSTRING_END, expecting tSTRING_CONTENT
or tREGEXP_END or tSTRING_DBEG or tSTRING_DVAR
p(/)
^
p(
t.rb:1: parse error, unexpected $, expecting ‘)’
Ok, the errors are obvious and I understand what messages mean… but I
don’t remember they were like this in the past.
Could someone confirm if (s)he’s getting this and if it is ok?
Hi,
In message “Re: Syntax error messages in 1.8.3”
on Tue, 14 Feb 2006 09:13:25 +0900, gabriele renzi
[email protected] writes:
|def
|t.rb:1: parse error, unexpected $
|Ok, the errors are obvious and I understand what messages mean… but I
|don’t remember they were like this in the past.
|Could someone confirm if (s)he’s getting this and if it is ok?
I’m getting this too. And this is a feature of bison 2.x, I guess.
matz.
Yukihiro M. ha scritto:
|Could someone confirm if (s)he’s getting this and if it is ok?
I’m getting this too. And this is a feature of bison 2.x, I guess.
matz.
I see, but would it be possible to replace internal identifiers such as
tSTRING_DVAR with something user-readable?
thanks
Hi,
In message “Re: Syntax error messages in 1.8.3”
on Thu, 16 Feb 2006 04:58:26 +0900, gabriele renzi
[email protected] writes:
|> I’m getting this too. And this is a feature of bison 2.x, I guess.
|I see, but would it be possible to replace internal identifiers such as
| tSTRING_DVAR with something user-readable?
I’m afraid not. Bison doesn’t give us a hook to replace it. Correct
me if I’m wrong.
matz.
gabriele renzi ha scritto:
(I think there is a switch in bison 2.1 to avoid " )
I was wrong, quoting the 2.1 announcement:
- When generating verbose diagnostics, Bison-generated parsers no longer
quote the literal strings associated with tokens. For example, for
a syntax error associated with ‘%token NUM “number”’ they might
print ‘syntax error, unexpected number’ instead of ‘syntax error,
unexpected “number”’.
Yukihiro M. ha scritto:
I’m afraid not. Bison doesn’t give us a hook to replace it. Correct
me if I’m wrong.
mh… I did some research/test, it seem you could just use something like
%token foo “expressive name”
i.e. adding this:
%token tSTRING_DVAR “embedded code”
%token tSTRING_END “end of String”
%token tSTRING_CONTENT “continuated String”
%token tREGEXP_END “end of Regexp”
%token tSTRING_DBEG “beginning of String”
to parse.y gives this result:
$miniruby
p(/)
^D
unterminated string meets end of file
syntax error, unexpected “end of String”, expecting “continuated String”
or “end of Regexp” or “beginning of String” or “embedded code”
(I think there is a switch in bison 2.1 to avoid " )
It is not a whole hook that could allow even better messages but it may
be better than the current internals identifiers.
Hope this helps.