setting up ant build

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 8684]
This commit is contained in:
parrt 2011-06-20 17:34:57 -08:00
parent d6e4d5fb42
commit a7bed42c35
8 changed files with 2326 additions and 1410 deletions

5
build.properties Normal file
View File

@ -0,0 +1,5 @@
version=4.0ea
antlr3.jar=/usr/local/lib/antlr-3.4-complete.jar
ant-antlr3.jar=${ant.library.dir}/ant-antlr3.jar
build.sysclasspath=ignore

150
build.xml
View File

@ -1,10 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project name="tool" default="compile"> <project name="ANTLR4" default="distribute" basedir=".">
<property file="build.properties"/> <property file="build.properties" />
<target name="compile"> <property name="src.dir" value="${basedir}/src" />
<javac srcdir="src" destdir="../build/classes"/> <property name="dist.dir" value="${basedir}/dist" />
<property name="build.dir" value="${basedir}/build" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="install.root.dir" value="${dist.dir}/antlr-${version}" />
<property name="jar.file" value="${dist.dir}/antlr-${version}.jar" />
<path id="classpath">
<pathelement location="${antlr3.jar}"/> <!-- general setup -->
<pathelement location="${ant-antlr3.jar}"/>
</path>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}/gen/org/antlr/v4" />
</target>
<target name="antlr" depends="init">
<echo>parse</echo>
<java classname="org.antlr.Tool" fork="true" failonerror="false" maxmemory="300m"
dir="${basedir}/tool/src/org/antlr/v4/parse">
<arg value="-make"/>
<arg value="ANTLRParser.g"/>
<arg value="ANTLRLexer.g"/>
<arg value="ActionSplitter.g"/>
<arg value="ASTVerifier.g"/>
<arg value="ATNBuilder.g"/>
<classpath>
<pathelement location="${antlr3.jar}"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<echo>semantics grammars</echo>
<java classname="org.antlr.Tool" fork="true" failonerror="false" maxmemory="300m"
dir="${basedir}/tool/src/org/antlr/v4/semantics">
<arg value="-make"/>
<arg value="-lib"/>
<arg value="../parse"/>
<arg value="BasicSemanticTriggers.g"/>
<arg value="CollectSymbols.g"/>
<classpath>
<pathelement location="${antlr3.jar}"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<echo>codegen grammars</echo>
<java classname="org.antlr.Tool" fork="true" failonerror="false" maxmemory="300m"
dir="${basedir}/tool/src/org/antlr/v4/codegen">
<arg value="-make"/>
<arg value="-lib"/>
<arg value="../parse"/>
<arg value="SourceGenTriggers.g"/>
<classpath>
<pathelement location="${antlr3.jar}"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<echo>gunit grammars</echo>
<java classname="org.antlr.Tool" fork="true" failonerror="false" maxmemory="300m"
dir="${basedir}/gunit/src/org/antlr/v4/gunit">
<arg value="-make"/>
<arg value="ASTVerifier.g"/>
<arg value="gUnit.g"/>
<arg value="jUnitGen.g"/>
<arg value="Semantics.g"/>
<classpath>
<pathelement location="${antlr3.jar}"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<target name="compile" depends="antlr" description="Compile for generic OS">
<mkdir dir="${build.dir}/classes"/>
<mkdir dir="${build.dir}/src"/>
<copy todir="${build.dir}/src" >
<fileset dir="src/"/>
</copy>
<replace dir="${build.dir}/src" token="@version@" value="${version}"/>
<javac
destdir="${build.dir}/classes"
source="1.5"
target="1.5"
debug="true"
excludes="org/antlr/v4/test/**">
<classpath refid="classpath"/>
<src path="${build.dir}/src:${build.dir}/gen"/>
</javac>
</target>
<target name="build-jar" depends="compile" description="Build ANTLR 4.jar">
<mkdir dir="${dist.dir}"/>
<jar jarfile="${jar.file}">
<fileset dir="${build.dir}/classes" includes="**/*.class"/>
<manifest>
<attribute name="Version" value="${version}"/>
</manifest>
</jar>
</target>
<target name="zip-source" depends="compile">
<mkdir dir="${install.root.dir}"/>
<mkdir dir="${install.root.dir}/src"/>
<copy todir="${install.root.dir}/src">
<fileset dir="src/">
<include name="**/*.java"/>
<include name="**/*.g"/>
<include name="**/*.st"/>
<include name="**/*.stg"/>
</fileset>
</copy>
<copy todir="${install.root.dir}">
<fileset dir=".">
<include name="build.properties"/>
<include name="build.xml"/>
<include name="LICENSE.txt"/>
<include name="README.txt"/>
<include name="doxyfile"/>
</fileset>
</copy>
<copy todir="${install.root.dir}/lib" file="${antlr3.jar}">
</copy>
<zip destfile="${dist.dir}/antlr-${version}-src.zip">
<zipfileset dir="${install.root.dir}" prefix="antlr-${version}"/>
</zip>
</target>
<target name="distribute" depends="clean, zip-source, build-jar">
</target> </target>
</project> </project>

File diff suppressed because it is too large Load Diff

View File

@ -73,6 +73,8 @@ import org.antlr.v4.runtime.tree.CommonTree; // use updated v4 one not v3
} }
} }
dummy : block[null] ; // avoid error about no start rule
block[GrammarAST ebnfRoot] returns [ATNFactory.Handle p] block[GrammarAST ebnfRoot] returns [ATNFactory.Handle p]
@init {List<ATNFactory.Handle> alts = new ArrayList<ATNFactory.Handle>();} @init {List<ATNFactory.Handle> alts = new ArrayList<ATNFactory.Handle>();}
: ^(BLOCK (^(OPTIONS .+))? (a=alternative {alts.add($a.p);})+) : ^(BLOCK (^(OPTIONS .+))? (a=alternative {alts.add($a.p);})+)

File diff suppressed because it is too large Load Diff

View File

@ -1,99 +1,99 @@
SEMPRED=4 ACTION=4
FORCED_ACTION=5 ACTION_CHAR_LITERAL=5
DOC_COMMENT=6 ACTION_ESC=6
SRC=7 ACTION_STRING_LITERAL=7
NLCHARS=8 ARG_ACTION=8
COMMENT=9 ASSIGN=9
DOUBLE_QUOTE_STRING_LITERAL=10 AT=10
DOUBLE_ANGLE_STRING_LITERAL=11 BANG=11
ACTION_STRING_LITERAL=12 CATCH=12
ACTION_CHAR_LITERAL=13 COLON=13
ARG_ACTION=14 COLONCOLON=14
NESTED_ACTION=15 COMMA=15
ACTION=16 COMMENT=16
ACTION_ESC=17 DOC_COMMENT=17
WSNLCHARS=18 DOLLAR=18
OPTIONS=19 DOT=19
TOKENS=20 DOUBLE_ANGLE_STRING_LITERAL=20
SCOPE=21 DOUBLE_QUOTE_STRING_LITERAL=21
IMPORT=22 ERRCHAR=22
FRAGMENT=23 ESC_SEQ=23
LEXER=24 ETC=24
PARSER=25 FINALLY=25
TREE=26 FORCED_ACTION=26
GRAMMAR=27 FRAGMENT=27
PROTECTED=28 GRAMMAR=28
PUBLIC=29 GT=29
PRIVATE=30 HEX_DIGIT=30
RETURNS=31 IMPLIES=31
THROWS=32 IMPORT=32
CATCH=33 INT=33
FINALLY=34 LEXER=34
TEMPLATE=35 LPAREN=35
MODE=36 LT=36
COLON=37 MODE=37
COLONCOLON=38 NESTED_ACTION=38
COMMA=39 NLCHARS=39
SEMI=40 NOT=40
LPAREN=41 OPTIONS=41
RPAREN=42 OR=42
IMPLIES=43 PARSER=43
LT=44 PLUS=44
GT=45 PLUS_ASSIGN=45
ASSIGN=46 PRIVATE=46
QUESTION=47 PROTECTED=47
BANG=48 PUBLIC=48
STAR=49 QUESTION=49
PLUS=50 RANGE=50
PLUS_ASSIGN=51 RARROW=51
OR=52 RBRACE=52
ROOT=53 RETURNS=53
DOLLAR=54 ROOT=54
DOT=55 RPAREN=55
RANGE=56 RULE_REF=56
ETC=57 SCOPE=57
RARROW=58 SEMI=58
TREE_BEGIN=59 SEMPRED=59
AT=60 SRC=60
NOT=61 STAR=61
RBRACE=62 STRING_LITERAL=62
TOKEN_REF=63 TEMPLATE=63
RULE_REF=64 THROWS=64
INT=65 TOKENS=65
WSCHARS=66 TOKEN_REF=66
ESC_SEQ=67 TREE=67
STRING_LITERAL=68 TREE_BEGIN=68
HEX_DIGIT=69 UNICODE_ESC=69
UNICODE_ESC=70 WS=70
WS=71 WSCHARS=71
ERRCHAR=72 WSNLCHARS=72
RULE=73 ALT=73
RULES=74 ALTLIST=74
RULEMODIFIERS=75 ALT_REWRITE=75
RULEACTIONS=76 ARG=76
BLOCK=77 ARGLIST=77
REWRITE_BLOCK=78 BACKTRACK_SEMPRED=78
OPTIONAL=79 BLOCK=79
CLOSURE=80 CHAR_RANGE=80
POSITIVE_CLOSURE=81 CLOSURE=81
SYNPRED=82 COMBINED=82
CHAR_RANGE=83 ELEMENT_OPTIONS=83
EPSILON=84 EPSILON=84
ALT=85 GATED_SEMPRED=85
ALTLIST=86 ID=86
ID=87 INITACTION=87
ARG=88 LABEL=88
ARGLIST=89 LIST=89
RET=90 OPTIONAL=90
COMBINED=91 POSITIVE_CLOSURE=91
INITACTION=92 RESULT=92
LABEL=93 RET=93
GATED_SEMPRED=94 REWRITE_BLOCK=94
SYN_SEMPRED=95 RULE=95
BACKTRACK_SEMPRED=96 RULEACTIONS=96
WILDCARD=97 RULEMODIFIERS=97
LIST=98 RULES=98
ELEMENT_OPTIONS=99 ST_RESULT=99
ST_RESULT=100 SYNPRED=100
RESULT=101 SYN_SEMPRED=101
ALT_REWRITE=102 WILDCARD=102

File diff suppressed because it is too large Load Diff

View File

@ -1,99 +1,99 @@
SEMPRED=4 ACTION=4
FORCED_ACTION=5 ACTION_CHAR_LITERAL=5
DOC_COMMENT=6 ACTION_ESC=6
SRC=7 ACTION_STRING_LITERAL=7
NLCHARS=8 ARG_ACTION=8
COMMENT=9 ASSIGN=9
DOUBLE_QUOTE_STRING_LITERAL=10 AT=10
DOUBLE_ANGLE_STRING_LITERAL=11 BANG=11
ACTION_STRING_LITERAL=12 CATCH=12
ACTION_CHAR_LITERAL=13 COLON=13
ARG_ACTION=14 COLONCOLON=14
NESTED_ACTION=15 COMMA=15
ACTION=16 COMMENT=16
ACTION_ESC=17 DOC_COMMENT=17
WSNLCHARS=18 DOLLAR=18
OPTIONS=19 DOT=19
TOKENS=20 DOUBLE_ANGLE_STRING_LITERAL=20
SCOPE=21 DOUBLE_QUOTE_STRING_LITERAL=21
IMPORT=22 ERRCHAR=22
FRAGMENT=23 ESC_SEQ=23
LEXER=24 ETC=24
PARSER=25 FINALLY=25
TREE=26 FORCED_ACTION=26
GRAMMAR=27 FRAGMENT=27
PROTECTED=28 GRAMMAR=28
PUBLIC=29 GT=29
PRIVATE=30 HEX_DIGIT=30
RETURNS=31 IMPLIES=31
THROWS=32 IMPORT=32
CATCH=33 INT=33
FINALLY=34 LEXER=34
TEMPLATE=35 LPAREN=35
MODE=36 LT=36
COLON=37 MODE=37
COLONCOLON=38 NESTED_ACTION=38
COMMA=39 NLCHARS=39
SEMI=40 NOT=40
LPAREN=41 OPTIONS=41
RPAREN=42 OR=42
IMPLIES=43 PARSER=43
LT=44 PLUS=44
GT=45 PLUS_ASSIGN=45
ASSIGN=46 PRIVATE=46
QUESTION=47 PROTECTED=47
BANG=48 PUBLIC=48
STAR=49 QUESTION=49
PLUS=50 RANGE=50
PLUS_ASSIGN=51 RARROW=51
OR=52 RBRACE=52
ROOT=53 RETURNS=53
DOLLAR=54 ROOT=54
DOT=55 RPAREN=55
RANGE=56 RULE_REF=56
ETC=57 SCOPE=57
RARROW=58 SEMI=58
TREE_BEGIN=59 SEMPRED=59
AT=60 SRC=60
NOT=61 STAR=61
RBRACE=62 STRING_LITERAL=62
TOKEN_REF=63 TEMPLATE=63
RULE_REF=64 THROWS=64
INT=65 TOKENS=65
WSCHARS=66 TOKEN_REF=66
ESC_SEQ=67 TREE=67
STRING_LITERAL=68 TREE_BEGIN=68
HEX_DIGIT=69 UNICODE_ESC=69
UNICODE_ESC=70 WS=70
WS=71 WSCHARS=71
ERRCHAR=72 WSNLCHARS=72
RULE=73 ALT=73
RULES=74 ALTLIST=74
RULEMODIFIERS=75 ALT_REWRITE=75
RULEACTIONS=76 ARG=76
BLOCK=77 ARGLIST=77
REWRITE_BLOCK=78 BACKTRACK_SEMPRED=78
OPTIONAL=79 BLOCK=79
CLOSURE=80 CHAR_RANGE=80
POSITIVE_CLOSURE=81 CLOSURE=81
SYNPRED=82 COMBINED=82
CHAR_RANGE=83 ELEMENT_OPTIONS=83
EPSILON=84 EPSILON=84
ALT=85 GATED_SEMPRED=85
ALTLIST=86 ID=86
ID=87 INITACTION=87
ARG=88 LABEL=88
ARGLIST=89 LIST=89
RET=90 OPTIONAL=90
COMBINED=91 POSITIVE_CLOSURE=91
INITACTION=92 RESULT=92
LABEL=93 RET=93
GATED_SEMPRED=94 REWRITE_BLOCK=94
SYN_SEMPRED=95 RULE=95
BACKTRACK_SEMPRED=96 RULEACTIONS=96
WILDCARD=97 RULEMODIFIERS=97
LIST=98 RULES=98
ELEMENT_OPTIONS=99 ST_RESULT=99
ST_RESULT=100 SYNPRED=100
RESULT=101 SYN_SEMPRED=101
ALT_REWRITE=102 WILDCARD=102