-
Notifications
You must be signed in to change notification settings - Fork 38
/
TargetPlatform.xtext
139 lines (116 loc) · 2.98 KB
/
TargetPlatform.xtext
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*******************************************************************************
* Copyright (c) 2012-2014 Obeo and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mikael Barbero (Obeo) - initial API and implementation
* Denis Golovin - Fix version qualifier parsing problems
* Hannes Niederhausen (itemis AG) - added maven related rules
*******************************************************************************/
grammar org.eclipse.cbi.targetplatform.TargetPlatform with org.eclipse.xtext.common.Terminals
import "org.eclipse.cbi.targetplatform.model"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
TargetPlatform:
(
'target' name=STRING
contents+=TargetContent*
)?
;
TargetContent:
Options | Environment | IncludeDeclaration | Location | MavenLocation
;
Options:
'with' options+=Option (','? options+=Option)*
;
Environment:
{Environment}
'environment' env+=ID (','? env+=ID)*
;
IncludeDeclaration:
'include' importURI=STRING
;
Location:
'location' ((ID=ID)? & uri=STRING) ('{'
('with' options+=Option (','? options+=Option)*)?
ius+=IU*
'}')?
;
MavenLocation:
'maven' label=ID
'scope' '=' scopes+=MavenScope (',' scopes+=MavenScope)* 'dependencyDepth' '=' dependencyDepth=MavenDependencyDepth
'missingManifest' '=' missingManifest=MavenMissingManifest
(includeSources?='includeSources')?
'{'
(generatedFeature=GeneratedFeature)?
(dependencies+=MavenDependency)+
(repositories+=MavenRepository)*
'}'
;
GeneratedFeature:
'feature' '{'
'id' '=' id=STRING
'name' '=' name=STRING
'version' '=' version=STRING
('vendor' '=' vendor=STRING)?
('installLibrary' '=' instalLibrary=STRING)?
('additionalBundles' '{'
(additionalBundles+=IU)+
'}')?
'}'
;
MavenDependency:
'dependency' '{'
'groupId' '=' groupId=STRING
'artifactId' '=' artifactId=STRING
'version' '=' version=STRING
('classifier' '=' classifier=STRING)?
('type' '=' type=STRING)?
'}'
;
MavenRepository:
'repository' 'id' '=' id=STRING 'url' '=' url=STRING
;
enum Option:
INCLUDE_REQUIRED |
INCLUDE_ALL_ENVIRONMENTS |
INCLUDE_SOURCE |
INCLUDE_CONFIGURE_PHASE
;
enum MavenScope:
COMPILE |
PROVIDED |
RUNTIME |
TEST |
SYSTEM |
IMPORT
;
enum MavenMissingManifest:
GENERATE |
ERROR |
IGNORE
;
enum MavenDependencyDepth:
NONE |
DIRECT |
INFINITE
;
IU:
ID=ID ( (';' 'version' '=')? (version=VersionRange|version=STRING) )?
;
Version hidden():
INT ('.' INT ('.' INT ('.' (ID|INT|QUALIFIER))?)?)?
;
VersionRange hidden (WS):
( ('('|'[') Version ',' Version (')'|']') ) | Version | 'lazy'
;
@Override
terminal INT returns ecore::EInt: ('0'..'9')+;
@Override
terminal ID: '^'?('a'..'z'|'A'..'Z'|'_') ('.'? ('a'..'z'|'A'..'Z'|'^'|'_'|'-'|'0'..'9'))*;
terminal QUALIFIER: ('a'..'z'|'A'..'Z'|'_'|'-'|'0'..'9')*;