[antlr-interest] MismatchedTokenException in java parsing

alexb577 4l3xb at bagehot.net
Sat Dec 27 10:56:11 PST 2003


Hi,

I am a developer at www.argouml.org(opensource uml tool) and we use
the java.g grammar for reverse engineering to uml. Sometimes we get
these exceptions thrown and I hope that with the information I provide
you can help identify the problem and what we can do to fix it.

Below is the logged exception and filename it happened in, then a
snippet from the java file itself and then a brief statement to say
where the position of the error is.

we use a modified java.g, which you can find here if it helps:
http://argouml.tigris.org/source/browse/argouml/src_new/org/argouml/uml/reveng/java/java.g?rev=1.18&content-type=text/vnd.viewcvs-markup

Also, the java files do compile.

thanks in advance
Alex

--------------------------------
ERROR: antlr.MismatchedTokenException Exception in file:
/.../hibernate-2.1/src/net/sf/hibernate/type/TypeFactory.java
TypeFactory.java (JavaImport.java:89)
 WARN: exception encountered in reverese engineering
line 43:3: expecting EOF, found 'basics' (Import.java:561)

public final class TypeFactory {
	
	private static final Map BASIC_TYPES;
	
	static {
		HashMap basics = new HashMap();
		basics.put( boolean.class.getName(), Hibernate.BOOLEAN);
		basics.put( long.class.getName(), Hibernate.LONG);

43:3 is the start of the last line above.

--------------------------------
ERROR: antlr.MismatchedTokenException Exception in file:
/.../org/argouml/util/LinkedHashMap.java LinkedHashMap.java
(JavaImport.java:89)
 WARN: exception encountered in reverese engineering
line 345:17: expecting EOF, found 'keySet' (Import.java:561)

            public void remove() {
                if (modCount != expectedModCount) throw new
java.util.ConcurrentModificationException();
                if (!valid) throw new IllegalStateException();
                if (!ValuesList.super.remove(lastObject)) throw new
java.util.ConcurrentModificationException();
                keySet.remove(index);
                entrySet.remove(index);
                ++modCount;
                ++expectedModCount;
                --index;
                valid = false;
            }

345:17 is the position of the 'k' in 'keySet.remove(index);'

--------------------------------
ERROR: antlr.MismatchedTokenException Exception in file:
/.../org/argouml/util/LinkedHashSet.java LinkedHashSet.java
(JavaImport.java:89)
 WARN: exception encountered in reverese engineering
line 147:13: expecting EOF, found 'listIterator' (Import.java:561)

        public void remove() {
            if (!valid) throw new IllegalStateException();
            LinkedHashSet.super.remove(lastObject);
            listIterator.remove();
            valid = false;
        }

147:13 is the position of the 'L' in
'LinkedHashSet.super.remove(lastObject);'



 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list