Bug 691113 - Improving error thrown when ; is missing from interface definition; r=khuey
authorAtul Aggarwal <atulagrwl@gmail.com>
Sun, 20 Nov 2011 11:13:40 +0000
changeset 82504 65e5ac1a24b81f6fce02dd7149e939f811d3c57c
parent 82503 06ce4a08992e33e4335802121f5dcac710b79ea2
child 82505 bb4b4b65beed86ed86411a7a215566a87a63394e
push id114
push userffxbld
push dateFri, 09 Mar 2012 01:01:18 +0000
treeherdermozilla-release@c081ebf13261 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs691113
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 691113 - Improving error thrown when ; is missing from interface definition; r=khuey
xpcom/idl-parser/xpidl.py
--- a/xpcom/idl-parser/xpidl.py
+++ b/xpcom/idl-parser/xpidl.py
@@ -1437,18 +1437,21 @@ class IDLParser(object):
         p[0] = [p[1]]
 
     def p_idlist_continue(self, p):
         """idlist : IDENTIFIER ',' idlist"""
         p[0] = list(p[3])
         p[0].insert(0, p[1])
 
     def p_error(self, t):
-        location = Location(self.lexer, t.lineno, t.lexpos)
-        raise IDLError("invalid syntax", location)
+        if not t:
+            raise IDLError("Syntax Error at end of file. Possibly due to missing semicolon(;), braces(}) or both", None)
+        else:
+            location = Location(self.lexer, t.lineno, t.lexpos)
+            raise IDLError("invalid syntax", location)
 
     def __init__(self, outputdir=''):
         self._doccomments = []
         self.lexer = lex.lex(object=self,
                              outputdir=outputdir,
                              lextab='xpidllex',
                              optimize=1)
         self.parser = yacc.yacc(module=self,