c956428d96
Previous patched version (1.4.3) from Itellij was dropped. As we are using skeleton from Intellij, we should update our jflex version accordingly
48 lines
1.9 KiB
XML
48 lines
1.9 KiB
XML
<project name="KotlinLexer" default="lexer">
|
|
<property name="home" value="${basedir}"/>
|
|
<property name="flex.base" value="${home}/../../dependencies/jflex"/>
|
|
<property name="out.dir" value="${basedir}/tmpout"/>
|
|
|
|
<macrodef name="flex">
|
|
<attribute name="flexfile"/>
|
|
<attribute name="destdir"/>
|
|
<attribute name="skeleton" default="${flex.base}/idea-flex.skeleton"/>
|
|
<sequential>
|
|
<delete dir="${out.dir}"/>
|
|
<mkdir dir="${out.dir}"/>
|
|
<java classname="jflex.Main"
|
|
jvmargs="-Xmx512M"
|
|
fork="true"
|
|
failonerror="true">
|
|
<arg value="-skel"/>
|
|
<arg value="@{skeleton}"/>
|
|
<arg value="-d"/>
|
|
<arg value="${out.dir}"/>
|
|
<arg value="@{flexfile}"/>
|
|
<classpath>
|
|
<pathelement location="${flex.base}/JFlex.jar"/>
|
|
</classpath>
|
|
</java>
|
|
<move todir="@{destdir}">
|
|
<fileset dir="${out.dir}">
|
|
<include name="*.java"/>
|
|
</fileset>
|
|
</move>
|
|
<delete dir="${out.dir}"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="lexer">
|
|
<flex flexfile="${home}/src/org/jetbrains/kotlin/lexer/Kotlin.flex"
|
|
destdir="${home}/src/org/jetbrains/kotlin/lexer/"/>
|
|
|
|
<!-- This is a hack, but we don't want to alter the skeleton we are using now, because being in sync with IDEA is more important-->
|
|
<replaceregexp file="${home}/src/org/jetbrains/kotlin/lexer/_JetLexer.java"
|
|
match="throw new KotlinLexerException\(message\);"
|
|
replace="throw new KotlinLexerException(message + "\\\\n at '" + yytext() + "'\\\\n" + zzBuffer);"/>
|
|
|
|
<flex flexfile="${home}/src/org/jetbrains/kotlin/kdoc/lexer/KDoc.flex"
|
|
destdir="${home}/src/org/jetbrains/kotlin/kdoc/lexer/"/>
|
|
</target>
|
|
</project>
|