antlr4_compile.cmd 4.98 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
@rem ###############################################################################
@rem # Copyright (c) 2000-2021 Ericsson Telecom AB
@rem # All rights reserved. This program and the accompanying materials
@rem # are made available under the terms of the Eclipse Public License v2.0
@rem # which accompanies this distribution, and is available at
@rem # https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
@rem #
@rem # Contributors:
@rem #   Lovassy, Arpad
@rem #   Magyari, Miklos
@rem #
@rem ###############################################################################

14
@rem ###############################################################################
15
16
17
18
19
@rem # Script for Windows to compile all the .g4 files in the Titan EclipsePlug-ins 
@rem # repo. Can be used to invoke antlr manually if the eclipse antlr plugin does
@rem # not work properly.
@rem # The script also builds helper classes for parser debuggig (these are not part
@rem # of the Titan build as they are only useful for parser developers).
20
21
22
@rem #
@rem # Example usage:
@rem #   cd <titan.EclipsePlug-ins project root>
23
@rem #   Tools/antlr4_compile.cmd 
24
25
@rem ###############################################################################

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@echo off

@set ANTLR_VERSION=4.3

:loop
@if not "%1"=="" (
    @if "%1"=="-av" (
        @set ANTLR_VERSION=%2
        @shift
    )
    @shift
    @goto :loop
)

@echo Using antlr version %ANTLR_VERSION%

42
43
44
@set CURDIR=%cd%
@set DIR=%~dp0
@set WORKSPACE_PATH=%DIR%\..
45
@set ANTLR=-cp %HOMEDRIVE%%HOMEPATH%\lib\\antlr-%ANTLR_VERSION%-complete.jar org.antlr.v4.Tool
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

@cd %WORKSPACE_PATH%\org.eclipse.titan.runtime\src\org\eclipse\titan\runtime\core\cfgparser\
@java %ANTLR% RuntimeCfgLexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.runtime.core.cfgparser
@java %ANTLR% RuntimeCfgParser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.runtime.core.cfgparser
@java %ANTLR% RuntimeCfgPreParser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.runtime.core.cfgparser

@REM Titan Common
@echo Compiling common
@cd %WORKSPACE_PATH%\org.eclipse.titan.common\src\org\eclipse\titan\common\parsers\cfg\

@java %ANTLR% CfgLexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.common.parsers.cfg
@java %ANTLR% CfgParser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.common.parsers.cfg

@rem Titan Designer
@REM ASN1
@echo Compiling ASN1
@cd %WORKSPACE_PATH%\org.eclipse.titan.designer\src\org\eclipse\titan\designer\parsers\asn1parser\
@java %ANTLR% Asn1Lexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.asn1parser
@java %ANTLR% Asn1Parser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.asn1parser

@REM TTCN3
@echo Compiling ttcn3
@cd %WORKSPACE_PATH%\org.eclipse.titan.designer\src\org\eclipse\titan\designer\parsers\ttcn3parser\
@java %ANTLR% PreprocessorDirectiveLexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.ttcn3parser
@java %ANTLR% PreprocessorDirectiveParser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.ttcn3parser
@java %ANTLR% Ttcn3Lexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.ttcn3parser
@java %ANTLR% Ttcn3KeywordlessLexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.ttcn3parser
@java %ANTLR% Ttcn3CharstringLexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.ttcn3parser
@java %ANTLR% Ttcn3Parser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.ttcn3parser
@java %ANTLR% Ttcn3Reparser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.ttcn3parser
@java %ANTLR% PatternStringLexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.ttcn3parser

@REM Extension attribute
79
@echo Compiling ext attr
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
@cd %WORKSPACE_PATH%\org.eclipse.titan.designer\src\org\eclipse\titan\designer\parsers\extensionattributeparser\
@java %ANTLR% ExtensionAttributeLexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.extensionattributeparser
@java %ANTLR% ExtensionAttributeParser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.extensionattributeparser

@REM Variant attribute
@echo Compiling var attr
@cd %WORKSPACE_PATH%\org.eclipse.titan.designer\src\org\eclipse\titan\designer\parsers\variantattributeparser\
@java %ANTLR% VariantAttributeLexer.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.variantattributeparser
@java %ANTLR% VariantAttributeParser.g4 -no-listener -no-visitor -encoding UTF-8 -package org.eclipse.titan.designer.parsers.variantattributeparser

@echo Generating ...LexerLogUtil.java files from ...Lexer.java files for resolving token names (OPTIONAL)
@cd %DIR%
@perl antlr4_generate_lexerlogutil.pl

@cd %CURDIR%