예제 #1
0
    def assert_incomplete(self, s):
        """Assert that s fails to parse with UnexpectedEndError.

        (This should be the case if `s` is a prefix of a valid Script.)
        """
        self.assertRaises(jsparagus.lexer.UnexpectedEndError,
                          lambda: parse_Script(s))
예제 #2
0
 def parse(self, s):
     if isinstance(s, list):
         f = JSLexer(JSParser())
         for chunk in s:
             f.write(chunk)
         return f.close()
     else:
         return parse_Script(s)
예제 #3
0
 def assert_syntax_error(self, s):
     """Assert that s fails to parse."""
     with self.assertRaises(jsparagus.lexer.SyntaxError):
         parse_Script(s)