File tree Expand file tree Collapse file tree 2 files changed +2
-9
lines changed
graalpython/com.oracle.graal.python.parser.antlr Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ define postprocess_file
57
57
python ${POSTPROCESSOR} $(1 )
58
58
endef
59
59
60
- ${PARSER_PATH}/% .java : ${SOURCE}
60
+ ${PARSER_PATH}/% .java : ${SOURCE} ${POSTPROCESSOR}
61
61
$(QUIETLY ) ${JAVA_HOME} /bin/java -cp ${ANTLR_JAR} org.antlr.v4.Tool -visitor -package ${PARSER_PKG} -o ${PARSER_PATH} ${SOURCE}
62
62
$(QUIETLY ) $(call postprocess_file,$@ )
63
63
Original file line number Diff line number Diff line change 48
48
"""
49
49
50
50
PTRN_SUPPRESS_WARNINGS = re .compile (r"@SuppressWarnings.*" )
51
- PTRN_GENBY = re .compile (r"Generated from (?P<path>.*)/(?P<grammar>.*.g4)" )
52
51
53
52
54
53
def replace_suppress_warnings (line ):
@@ -59,23 +58,17 @@ def replace_rulectx(line):
59
58
return line .replace ("(RuleContext)_localctx" , "_localctx" )
60
59
61
60
62
- def replace_genby (line ):
63
- return PTRN_GENBY .sub ("Generated from \g<grammar>" , line )
64
-
65
-
66
61
TRANSFORMS = [
67
62
replace_suppress_warnings ,
68
63
replace_rulectx ,
69
- replace_genby ,
70
64
]
71
65
72
66
73
67
def postprocess (file ):
74
68
lines = []
75
69
for line in file :
76
70
for transform in TRANSFORMS :
77
- if hasattr (transform , '__call__' ):
78
- line = transform (line )
71
+ line = transform (line )
79
72
lines .append (line )
80
73
return '' .join (lines )
81
74
You can’t perform that action at this time.
0 commit comments