예제 #1
0
 def testCanParseAndTranslateMultilineElements(self):
     jsx = "return <a>\n\t<b/>\n\t<b/>\n</a>"
     parser = MCleverParser(text=jsx)
     stmt = parser.doParse(parser.return_statement, True)
     self.assertIsNotNone(stmt.expression)
     writer = CodeWriter(Dialect.M, Context.newGlobalContext())
     stmt.toDialect(writer)
     out = str(writer)
     self.assertEquals(jsx, out)
예제 #2
0
 def testCanParseAndTranslateMultilineAttributes(self):
     jsx = "return <a \n\tx=\"abc\"\n\ty=\"def\"\n\tz=\"stuff\" />"
     parser = MCleverParser(text=jsx)
     stmt = parser.doParse(parser.return_statement, True)
     self.assertIsNotNone(stmt.expression)
     writer = CodeWriter(Dialect.M, Context.newGlobalContext())
     stmt.toDialect(writer)
     out = str(writer)
     self.assertEquals(jsx, out)
예제 #3
0
 def parseMResource(self, resourceName):
     stream = self.getResourceAsStream(resourceName, 'rb')
     self.assertIsNotNone("resource not found:" + resourceName, stream)
     parser = MCleverParser(stream=stream)
     return self.parse(MPromptoBuilder, parser)
예제 #4
0
 def parseMString(self, code):
     parser = MCleverParser(text=code)
     return self.parse(MPromptoBuilder, parser)