carbidev/com.nokia.tools.variant.confml.expressions_1.0.0.v20090225_01-11/src/com/nokia/tools/variant/confml/expressions/settings/Confml.g
author terytkon
Wed, 02 Jun 2010 10:50:41 +0300
changeset 1 fe41c66bacc7
parent 0 30eb2d538f02
permissions -rw-r--r--
Changed rest of the sfl licences to epl :)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
     1
/*
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
     3
 * All rights reserved.
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
1
fe41c66bacc7 Changed rest of the sfl licences to epl :)
terytkon
parents: 0
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
0
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
1
fe41c66bacc7 Changed rest of the sfl licences to epl :)
terytkon
parents: 0
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
0
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
     8
 * 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
     9
 * Initial Contributors:
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    10
 * Nokia Corporation - Initial contribution
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    11
 * 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    12
 * Contributors:
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    13
 * 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    14
 * Description: This file is part of com.nokia.tools.variant.confml.expressions component.
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    15
 */
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    16
grammar Confml;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    17
 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    18
@header { 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    19
  package com.nokia.tools.variant.confml.expressions.settings;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    20
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    21
  import java.util.HashSet;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    22
  import java.util.Set;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    23
  import org.eclipse.emf.common.util.*;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    24
  import com.nokia.tools.variant.content.confml.*;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    25
}
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    26
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    27
@members {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    28
  private View view;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    29
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    30
  public void setView(View view) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    31
    this.view = view;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    32
  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    33
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    34
  public View getView() {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    35
    return view;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    36
  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    37
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    38
  private SequenceItem sequenceItem;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    39
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    40
  public SequenceItem getSequenceItem() {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    41
    return sequenceItem;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    42
  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    43
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    44
  public void setSequenceItem(SequenceItem si) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    45
    this.sequenceItem = si;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    46
  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    47
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    48
  private Setting setting;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    49
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    50
  public void setSetting(Setting setting) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    51
    this.setting = setting;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    52
  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    53
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    54
  public Setting getSetting() {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    55
    return setting;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    56
  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    57
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    58
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    59
  private String featureRef;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    60
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    61
  public void setFeatureRef(String featureRef) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    62
    this.featureRef = featureRef;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    63
  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    64
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    65
  public String getFeatureRef() {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    66
    return featureRef; 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    67
  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    68
}
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    69
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    70
@lexer::header {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    71
  package com.nokia.tools.variant.confml.expressions.settings;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    72
}
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    73
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    74
// ##################### BASIC EXPRESSIONS
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    75
expr returns [Set<Setting> settings]: 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    76
  (e = orExpr NEWLINE             {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    77
                                    settings = e;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    78
                                  })*
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    79
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    80
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    81
// ##################### BOOLEAN EXPRESSIONS
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    82
orExpr returns [Set<Setting> settings]:
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    83
  e1 = andExpr                    {  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    84
                                    settings = e1;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    85
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    86
  (
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    87
    'or'  e2 = andExpr            {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    88
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    89
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    90
  )*
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    91
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    92
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    93
andExpr returns [Set<Setting> settings]:
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    94
  e1 = equalityExpr               {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    95
                                    settings = e1;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    96
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    97
  (
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    98
    'and' e2 = equalityExpr       {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
    99
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   100
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   101
  )*
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   102
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   103
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   104
equalityExpr returns [Set<Setting> settings]: 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   105
  e1 = relationalExpr             { 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   106
                                    settings = e1;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   107
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   108
  (
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   109
    '='   e2 = relationalExpr     {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   110
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   111
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   112
  | '!='  e2 = relationalExpr     {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   113
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   114
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   115
  )*
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   116
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   117
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   118
relationalExpr returns [Set<Setting> settings]:
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   119
  e1 = additiveExpr               { 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   120
                                    settings = e1;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   121
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   122
  (
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   123
    '<'   e2 = additiveExpr       {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   124
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   125
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   126
                                           
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   127
  | '>'   e2 = additiveExpr       {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   128
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   129
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   130
                                           
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   131
  | '<='  e2 = additiveExpr       {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   132
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   133
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   134
                                           
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   135
  | '>='  e2 = additiveExpr       {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   136
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   137
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   138
  )*
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   139
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   140
  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   141
// ################# Numeric Expressions
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   142
additiveExpr returns [Set<Setting> settings] : 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   143
	e1 = multiplicativeExpr         {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   144
	                                  settings = e1;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   145
	                                }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   146
	(
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   147
	  '+'   e2 = multiplicativeExpr {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   148
	                                  settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   149
	                                } 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   150
    | '-' e2 = multiplicativeExpr {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   151
                                    settings.addAll(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   152
                                  } 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   153
	)*
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   154
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   155
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   156
multiplicativeExpr returns [Set<Setting> settings]: 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   157
	e1 = unaryExpr                  {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   158
			                              settings = new HashSet<Setting>();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   159
			                              settings.add(e1);	
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   160
	                                }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   161
	(
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   162
	  '*'   e2 = unaryExpr          {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   163
			                              settings.add(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   164
	                                }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   165
	| 'div' e2 = unaryExpr          {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   166
			                              settings.add(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   167
			                            }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   168
	| 'mod' e2 = unaryExpr          {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   169
			                              settings.add(e2);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   170
			                            }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   171
	)* 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   172
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   173
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   174
unaryExpr returns [Setting setting]: 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   175
  e1 = primaryExpr                {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   176
                                    setting = e1;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   177
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   178
  | '-' e2 = primaryExpr          {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   179
                                    setting = e2;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   180
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   181
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   182
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   183
primaryExpr returns [Setting setting]: 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   184
  e1 = settingRef                 { 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   185
                                    setting = e1;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   186
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   187
  | '(' orExpr ')'                { }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   188
  | Literal                       { }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   189
  | Number                        { }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   190
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   191
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   192
// ################# Expression Lexical Structure
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   193
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   194
settingRef returns [Setting setting]: 
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   195
  '.'                             {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   196
                                    setting = getSetting();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   197
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   198
  | r = Ref                       {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   199
                                    Setting s = getSetting();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   200
	                                  String currentFeatureRef = getFeatureRef();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   201
	                                  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   202
	                                  EList<Setting> allSettings = view.getSharedSettingInstances();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   203
	                                  if (s != null) {// Context is Setting
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   204
	                                   String absRef = s.getAbsRef();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   205
	                                   String[] refs = absRef.split("/");
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   206
	                                   if (refs.length == 2) {// simple setting context
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   207
	                                    String featureRef = absRef.substring(0, absRef.indexOf('/'));
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   208
	                                    String searchSettingAbsRef = featureRef + "/" + r.getText();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   209
	                                    for (int i = 0 ; i < allSettings.size() ; i++) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   210
	                                      Setting si = allSettings.get(i);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   211
	                                      if (si.getAbsRef().equals(searchSettingAbsRef)) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   212
	                                        setting = si;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   213
	                                        break;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   214
	                                      }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   215
	                                    }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   216
	                                   } else {// subsetting context
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   217
	                                     SequenceItem si = getSequenceItem();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   218
	                                     EList<Setting> subsettings = si.getSetting();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   219
	                                     for (int i = 0 ; i < subsettings.size() ; i++) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   220
	                                       Setting ss = subsettings.get(i);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   221
	                                       if (ss.getSettingRef().equals(r.getText())) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   222
	                                           setting = ss;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   223
	       	                                  break;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   224
	        	                                }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   225
	                                     }	                                                  
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   226
	                                   }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   227
	                                  } else if (currentFeatureRef != null) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   228
	                                    String searchedSettingAbsRef = currentFeatureRef + "/" + r.getText();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   229
	                                    for (int i = 0 ; i < allSettings.size() ; i++) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   230
	                                      Setting si = allSettings.get(i);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   231
	                                      if (si.getAbsRef().equals(searchedSettingAbsRef)) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   232
	                                        setting = si;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   233
	                                        break;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   234
	                                      }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   235
	                                    }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   236
	                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   237
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   238
  | (r1 = Ref '/' r2 = Ref)       {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   239
	                                  String absRef = r1.getText() + "/" + r2.getText();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   240
	                                  EList<Setting> settings = view.getSharedSettingInstances();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   241
	                                  Setting s = null;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   242
	                                  for (int i = 0 ; i < settings.size() ; i++) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   243
	                                    Setting x = settings.get(i);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   244
	                                    if (x.getAbsRef().equals(absRef)) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   245
	                                      s = x;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   246
	                                      break;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   247
	                                    }                                                
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   248
	                                  }                                               
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   249
	                                  setting = s;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   250
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   251
  | (r1 = Ref '/' rx = Ref '[' n = Number ']' '/' rs = Ref)
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   252
                                  {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   253
                                    int index = Integer.parseInt(n.getText());
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   254
                                    String absRef = r1.getText() + "/" + rx.getText();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   255
                                    EList<Setting> settings = view.getSharedSettingInstances();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   256
                                    Setting s = null;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   257
                                    for (int i = 0 ; i < settings.size() ; i++) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   258
                                      Setting x = settings.get(i);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   259
                                      if (x.getAbsRef().equals(absRef)) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   260
                                        s = x;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   261
                                        break;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   262
                                      }                                                
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   263
                                    }                                               
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   264
                                    if (s instanceof SequenceSetting) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   265
                                      SequenceSetting ss = (SequenceSetting) s;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   266
                                      String subSettingAbsRef = absRef + "/" + rs.getText();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   267
                                      EList<SequenceItem> items = ss.getSequenceItem();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   268
                                      if (index < items.size()) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   269
                                        SequenceItem si = items.get(index);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   270
                                        EList<Setting> subsettings = si.getSetting();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   271
                                        for (int i = 0 ; i < subsettings.size() ; i++) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   272
                                          Setting subSetting = subsettings.get(i);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   273
                                          if (subSetting.getAbsRef().equals(subSettingAbsRef)) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   274
                                            setting = subSetting;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   275
                                            break;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   276
                                          }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   277
                                        }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   278
                                      }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   279
                                    }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   280
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   281
  | r1 = Ref '/' r2 = Ref '/' r3 = Ref
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   282
                                  {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   283
	                                  String absRef = r1.getText() + "/" + r2.getText();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   284
	                                  EList<Setting> settings = view.getSharedSettingInstances();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   285
	                                  Setting s = null;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   286
	                                  for (int i = 0 ; i < settings.size() ; i++) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   287
	                                    Setting x = settings.get(i);
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   288
	                                    if (x.getAbsRef().equals(absRef)) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   289
	                                      s = x;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   290
	                                      break;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   291
	                                    }                                                
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   292
	                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   293
	                                  String text = r3.getText();
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   294
	                                  if (text.equals("localPath") || text.equals("targetPath")) {
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   295
	                                    setting = s;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   296
	                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   297
                                  }
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   298
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   299
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   300
Ref :        ('a'..'z' | 'A'..'Z' ) ('a'..'z' | 'A'..'Z' | '0'..'9' | '.' | '-' | '_')*
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   301
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   302
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   303
Literal :
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   304
    '"' .* '"'
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   305
  | '\'' .* '\''
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   306
  | '&apos;' .* '&apos;'
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   307
  | '&quot;' .* '&quot;'
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   308
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   309
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   310
Number : ('0'..'9')+ ('.' ('0'..'9')+)?
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   311
  | '.' ('0'..'9')+
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   312
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   313
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   314
NEWLINE : '\r' ? '\n'
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   315
;
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   316
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   317
WS : (' ' |'\t' |'\n' |'\r' )+ {skip();}
30eb2d538f02 Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff changeset
   318
;