Skip to content

Commit d10f8c8

Browse files
committed
Added top-level Makefile.
Temp fix for crashes in compiler.
1 parent 6de7f49 commit d10f8c8

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.PHONY: all install clean
2+
.SILENT: clean
3+
4+
all:
5+
$(MAKE) -C java2python/lang
6+
python setup.py build
7+
8+
install: all
9+
python setup.py install
10+
11+
clean:
12+
$(MAKE) -C java2python/lang clean
13+
rm -f *.pyo
14+
rm -f *.pyc
15+
rm -f *Parser.py
16+
rm -f *Lexer.py
17+
rm -f *.tokens

java2python/compiler/visitor.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ def makeAcceptType(ft):
117117
""" Creates an accept function for the given factory type. """
118118
def acceptType(self, node, memo):
119119
""" Creates and returns a new template for a type. """
120-
name = node.firstChildOfType(tokens.IDENT).text
121-
self.variables.append(name)
122-
return getattr(self.factory, ft)(name=name, parent=self)
120+
try:
121+
name = node.firstChildOfType(tokens.IDENT).text
122+
self.variables.append(name)
123+
return getattr(self.factory, ft)(name=name, parent=self)
124+
except:
125+
return None
123126
return acceptType
124127

125128
acceptAt = makeAcceptType('at')

java2python/lang/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
JavaLexer.py
2+
JavaParser.py
3+
Java.tokens

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
'java2python.lang',
1313
'java2python.compiler',
1414
],
15+
package_data={'java2python.lang': ['Java.tokens']},
1516
scripts=['bin/j2py'],
1617
)

0 commit comments

Comments
 (0)