This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/20056] New: improve parse error message involving expect_op("...")


https://sourceware.org/bugzilla/show_bug.cgi?id=20056

            Bug ID: 20056
           Summary: improve parse error message involving expect_op("...")
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: fche at redhat dot com
  Target Milestone: ---

We have a number of constructs where peek_op() is followed by expect_op(), as
alternatives.  For example:

probe begin { println("2" }  }
                          ^ this is should be a ')' or ','

but the error message indicates only that a ',' was expected.  That's
because the parser::expect_op() doesn't take alternatives.  Maybe we need
an expect_op variant that takes a list of operators that are acceptable
there (like expect_known - but expressing alternation); that'd mean
reworking the control structures that look like

03826                   // Consume any subsequent arguments.                    
03827                   while (!peek_op (")"))
03828                     {
03829                       expect_op(",");
03830                       expression *e = parse_expression ();
03831                       fmt->args.push_back(e);
03832                     }
.....
03880           expect_op(")");

to consume "," or ")" early on.


A less coding-intensive alternative would be to give expect_op an extra
explanation-text parameter that expect_known could just append to its
PARSE_ERROR.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]