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

154
build.xml
View File

@ -1,10 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="tool" default="compile">
<property file="build.properties"/>
<project name="ANTLR4" default="distribute" basedir=".">
<target name="compile">
<javac srcdir="src" destdir="../build/classes"/>
<property file="build.properties" />
<property name="src.dir" value="${basedir}/src" />
<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>
</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]
@init {List<ATNFactory.Handle> alts = new ArrayList<ATNFactory.Handle>();}
: ^(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
FORCED_ACTION=5
DOC_COMMENT=6
SRC=7
NLCHARS=8
COMMENT=9
DOUBLE_QUOTE_STRING_LITERAL=10
DOUBLE_ANGLE_STRING_LITERAL=11
ACTION_STRING_LITERAL=12
ACTION_CHAR_LITERAL=13
ARG_ACTION=14
NESTED_ACTION=15
ACTION=16
ACTION_ESC=17
WSNLCHARS=18
OPTIONS=19
TOKENS=20
SCOPE=21
IMPORT=22
FRAGMENT=23
LEXER=24
PARSER=25
TREE=26
GRAMMAR=27
PROTECTED=28
PUBLIC=29
PRIVATE=30
RETURNS=31
THROWS=32
CATCH=33
FINALLY=34
TEMPLATE=35
MODE=36
COLON=37
COLONCOLON=38
COMMA=39
SEMI=40
LPAREN=41
RPAREN=42
IMPLIES=43
LT=44
GT=45
ASSIGN=46
QUESTION=47
BANG=48
STAR=49
PLUS=50
PLUS_ASSIGN=51
OR=52
ROOT=53
DOLLAR=54
DOT=55
RANGE=56
ETC=57
RARROW=58
TREE_BEGIN=59
AT=60
NOT=61
RBRACE=62
TOKEN_REF=63
RULE_REF=64
INT=65
WSCHARS=66
ESC_SEQ=67
STRING_LITERAL=68
HEX_DIGIT=69
UNICODE_ESC=70
WS=71
ERRCHAR=72
RULE=73
RULES=74
RULEMODIFIERS=75
RULEACTIONS=76
BLOCK=77
REWRITE_BLOCK=78
OPTIONAL=79
CLOSURE=80
POSITIVE_CLOSURE=81
SYNPRED=82
CHAR_RANGE=83
ACTION=4
ACTION_CHAR_LITERAL=5
ACTION_ESC=6
ACTION_STRING_LITERAL=7
ARG_ACTION=8
ASSIGN=9
AT=10
BANG=11
CATCH=12
COLON=13
COLONCOLON=14
COMMA=15
COMMENT=16
DOC_COMMENT=17
DOLLAR=18
DOT=19
DOUBLE_ANGLE_STRING_LITERAL=20
DOUBLE_QUOTE_STRING_LITERAL=21
ERRCHAR=22
ESC_SEQ=23
ETC=24
FINALLY=25
FORCED_ACTION=26
FRAGMENT=27
GRAMMAR=28
GT=29
HEX_DIGIT=30
IMPLIES=31
IMPORT=32
INT=33
LEXER=34
LPAREN=35
LT=36
MODE=37
NESTED_ACTION=38
NLCHARS=39
NOT=40
OPTIONS=41
OR=42
PARSER=43
PLUS=44
PLUS_ASSIGN=45
PRIVATE=46
PROTECTED=47
PUBLIC=48
QUESTION=49
RANGE=50
RARROW=51
RBRACE=52
RETURNS=53
ROOT=54
RPAREN=55
RULE_REF=56
SCOPE=57
SEMI=58
SEMPRED=59
SRC=60
STAR=61
STRING_LITERAL=62
TEMPLATE=63
THROWS=64
TOKENS=65
TOKEN_REF=66
TREE=67
TREE_BEGIN=68
UNICODE_ESC=69
WS=70
WSCHARS=71
WSNLCHARS=72
ALT=73
ALTLIST=74
ALT_REWRITE=75
ARG=76
ARGLIST=77
BACKTRACK_SEMPRED=78
BLOCK=79
CHAR_RANGE=80
CLOSURE=81
COMBINED=82
ELEMENT_OPTIONS=83
EPSILON=84
ALT=85
ALTLIST=86
ID=87
ARG=88
ARGLIST=89
RET=90
COMBINED=91
INITACTION=92
LABEL=93
GATED_SEMPRED=94
SYN_SEMPRED=95
BACKTRACK_SEMPRED=96
WILDCARD=97
LIST=98
ELEMENT_OPTIONS=99
ST_RESULT=100
RESULT=101
ALT_REWRITE=102
GATED_SEMPRED=85
ID=86
INITACTION=87
LABEL=88
LIST=89
OPTIONAL=90
POSITIVE_CLOSURE=91
RESULT=92
RET=93
REWRITE_BLOCK=94
RULE=95
RULEACTIONS=96
RULEMODIFIERS=97
RULES=98
ST_RESULT=99
SYNPRED=100
SYN_SEMPRED=101
WILDCARD=102

File diff suppressed because it is too large Load Diff

View File

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