Bug 35409 - RC2 Compiler produces bogus error messages
Summary: RC2 Compiler produces bogus error messages
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-20 16:17 EST by Bob Foster CLA
Modified: 2003-07-16 04:38 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Foster CLA 2003-03-20 16:17:43 EST
The following code snippet compiles without error:

	private static Exp COMPLEXEXTENSION_CHILDREN =
	sFac.concat(
		sFac.optional("annotation"),
		sFac.concat(
			sFac.optional(
				sFac.union(new String[] 
{"group","all","choice","sequence"})),
			sFac.concat(
				sFac.star(
					sFac.union(new String[] 
{"attribute","attributeGroup"})),
				sFac.optional("anyAttribute"))));
	//Content: (annotation?, ((attribute | attributeGroup)*, 
anyAttribute?))
	private static Exp SIMPLEEXTENSION_CHILDREN =
	sFac.concat(
		sFac.optional("annotation"),
		sFac.concat(
			sFac.optional(
				sFac.union(new String[] 
{"group","all","choice","sequence"})),
			sFac.concat(
				sFac.star(
					sFac.union(new String[] 
{"attribute","attributeGroup"})),
				sFac.optional("anyAttribute"))));

When the following line is added:

	private static Exp GROUP_CHILDREN =

(an incomplete declaration) the compiler erroneously marks each first instance 
of a comma in the String initializers preceding it as an error, with the error 
message:

Syntax error: ",",...expected

The character marked _is_ a ","!

To be perfectly clear, an error after these declarations is incorrectly 
causing bogus errors to be flagged within the declarations, before the actual 
error. The resulting blizzard of error flags makes it very difficult to work.

BTW, change the above line to, e.g.:

	private static Exp GROUP_CHILDREN = Exp.Epsilon;

And all the bogus errors preceding it go away.
Comment 1 Philipe Mulet CLA 2003-03-21 05:04:55 EST
It is confusing indeed, we have a few other instances where syntax error 
messages could be improved. Post 2.1
Comment 2 Philipe Mulet CLA 2003-04-02 06:12:50 EST
We are considering improving our syntax error messages
Comment 3 David Audel CLA 2003-06-17 09:02:41 EDT
Fixed.
Comment 4 David Audel CLA 2003-07-16 04:38:46 EDT
Verified.