[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #45947] savepath can create a ~/.octaverc that
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #45947] savepath can create a ~/.octaverc that crashes Octave at startup |
Date: |
Thu, 12 May 2016 00:46:30 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 |
Follow-up Comment #9, bug #45947 (project octave):
It isn't so hard to do. One way to eliminate the variable trailing context is
to have explicit rules. This would catch the majority of instances, and is
probably good enough given the 80/20 rule. For example, catching "get|set"
followed by 0,1,2 spaces and a then a parenthesis would be:
(set|get)/\( {
HANDLE_IDENTIFIER ("(set|get)/\\(", true);
}
(set|get)/{S}\( {
HANDLE_IDENTIFIER ("(set|get)/{S}\\(", true);
}
(set|get)/{S}{S}\( {
HANDLE_IDENTIFIER ("(set|get)/{S}{S}\\(", true);
}
I've tested this and it works.
Alternatively, remove the trailing context from the Flex pattern, but then you
need to strip out the whitespace yourself.
This pattern works to stop the segfault.
(set|get){S}*\( {
HANDLE_IDENTIFIER ("(set|get){S}*\\(", true);
}
However, the HANDLE_IDENTIFIER macro needs to be changed since the whitespace
is now included in yytext.
else \
{ \
if (get_set) \
curr_lexer->maybe_classdef_get_set_method = false; \
\
int id_tok = curr_lexer->handle_identifier (); \
\
if (id_tok >= 0) \
return curr_lexer->count_token_internal (id_tok); \
} \
I changed the code clause where get_set is true to this
if (get_set) \
{ \
yyless (3); \
curr_lexer->maybe_classdef_get_set_method = false; \
} \
and it works ("make check" passes).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?45947>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/