diff --git a/src/main/gen/se/isselab/HAnS/featureModel/FeatureModelHighlightingLexer.java b/src/main/gen/se/isselab/HAnS/featureModel/FeatureModelHighlightingLexer.java
index 6891649e..e5d9cc01 100644
--- a/src/main/gen/se/isselab/HAnS/featureModel/FeatureModelHighlightingLexer.java
+++ b/src/main/gen/se/isselab/HAnS/featureModel/FeatureModelHighlightingLexer.java
@@ -1,18 +1,29 @@
-/* The following code was generated by JFlex 1.7.0 tweaked for IntelliJ platform */
+// Generated by JFlex 1.9.2 http://jflex.de/ (tweaked for IntelliJ platform)
+// source: FeatureModelHighlightingLexer.flex
+/*
+Copyright 2021 Herman Jansson & Johan Martinson
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
package se.isselab.HAnS.featureModel;
+import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import se.isselab.HAnS.featureModel.psi.FeatureModelTypes;
-import com.intellij.lexer.FlexLexer;
import com.intellij.psi.TokenType;
-/**
- * This class is a scanner generated by
- * JFlex 1.7.0
- * from the specification file FeatureModelHighlightingLexer.flex
- */
public class FeatureModelHighlightingLexer implements FlexLexer {
/** This character denotes the end of file */
@@ -31,42 +42,79 @@ public class FeatureModelHighlightingLexer implements FlexLexer {
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
- private static final int ZZ_LEXSTATE[] = {
+ private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1
};
- /**
- * Translates characters to character classes
- * Chosen bits are [8, 6, 7]
- * Total runtime size is 1040 bytes
+ /**
+ * Top-level table for translating characters to character classes
*/
- public static int ZZ_CMAP(int ch) {
- return ZZ_CMAP_A[ZZ_CMAP_Y[ZZ_CMAP_Z[ch>>13]|((ch>>7)&0x3f)]|(ch&0x7f)];
+ private static final int [] ZZ_CMAP_TOP = zzUnpackcmap_top();
+
+ private static final String ZZ_CMAP_TOP_PACKED_0 =
+ "\1\0\u10ff\u0100";
+
+ private static int [] zzUnpackcmap_top() {
+ int [] result = new int[4352];
+ int offset = 0;
+ offset = zzUnpackcmap_top(ZZ_CMAP_TOP_PACKED_0, offset, result);
+ return result;
+ }
+
+ private static int zzUnpackcmap_top(String packed, int offset, int [] result) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ do result[j++] = value; while (--count > 0);
+ }
+ return j;
}
- /* The ZZ_CMAP_Z table has 136 entries */
- static final char ZZ_CMAP_Z[] = zzUnpackCMap(
- "\1\0\207\100");
- /* The ZZ_CMAP_Y table has 128 entries */
- static final char ZZ_CMAP_Y[] = zzUnpackCMap(
- "\1\0\177\200");
+ /**
+ * Second-level tables for translating characters to character classes
+ */
+ private static final int [] ZZ_CMAP_BLOCKS = zzUnpackcmap_blocks();
+
+ private static final String ZZ_CMAP_BLOCKS_PACKED_0 =
+ "\11\0\1\1\1\2\2\0\1\2\22\0\1\1\6\0"+
+ "\1\3\3\0\1\4\4\0\12\4\5\0\1\5\1\0"+
+ "\32\4\4\0\1\4\1\0\16\4\1\6\2\4\1\7"+
+ "\5\4\1\10\2\4\1\0\1\11\u0183\0";
- /* The ZZ_CMAP_A table has 256 entries */
- static final char ZZ_CMAP_A[] = zzUnpackCMap(
- "\11\0\1\2\1\1\2\0\1\1\22\0\1\2\6\0\1\5\3\0\1\3\4\0\12\3\7\0\32\3\4\0\1\3\1"+
- "\0\32\3\1\0\1\4\203\0");
+ private static int [] zzUnpackcmap_blocks() {
+ int [] result = new int[512];
+ int offset = 0;
+ offset = zzUnpackcmap_blocks(ZZ_CMAP_BLOCKS_PACKED_0, offset, result);
+ return result;
+ }
+
+ private static int zzUnpackcmap_blocks(String packed, int offset, int [] result) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ do result[j++] = value; while (--count > 0);
+ }
+ return j;
+ }
- /**
+ /**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
- "\2\0\1\1\1\2\1\3\3\4";
+ "\2\0\1\1\1\2\1\3\2\4\1\5\3\4\2\1"+
+ "\1\6\1\4\1\6\1\0\2\7";
private static int [] zzUnpackAction() {
- int [] result = new int[8];
+ int [] result = new int[19];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
@@ -85,16 +133,18 @@ private static int zzUnpackAction(String packed, int offset, int [] result) {
}
- /**
+ /**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
- "\0\0\0\6\0\14\0\22\0\30\0\36\0\44\0\52";
+ "\0\0\0\12\0\24\0\36\0\50\0\62\0\74\0\24"+
+ "\0\106\0\120\0\132\0\144\0\156\0\74\0\170\0\24"+
+ "\0\202\0\74\0\24";
private static int [] zzUnpackRowMap() {
- int [] result = new int[8];
+ int [] result = new int[19];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
@@ -103,7 +153,7 @@ private static int zzUnpackAction(String packed, int offset, int [] result) {
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
- int l = packed.length();
+ int l = packed.length() - 1;
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
@@ -111,25 +161,30 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) {
return j;
}
- /**
+ /**
* The transition table of the DFA
*/
- private static final int [] ZZ_TRANS = zzUnpackTrans();
+ private static final int [] ZZ_TRANS = zzUnpacktrans();
private static final String ZZ_TRANS_PACKED_0 =
- "\1\3\1\4\1\5\1\6\1\7\1\10\1\3\1\4"+
- "\1\5\1\3\1\4\1\5\7\0\1\4\2\0\1\4"+
- "\3\0\1\5\2\0\1\5\3\0\3\6\1\0\1\4"+
- "\1\0\1\6\1\7\1\6\2\0\1\5\2\6\1\10";
-
- private static int [] zzUnpackTrans() {
- int [] result = new int[48];
+ "\1\3\1\4\1\5\1\6\1\7\1\10\1\11\1\7"+
+ "\1\12\1\13\1\3\1\4\1\5\1\4\1\3\1\10"+
+ "\1\14\1\3\1\15\1\5\13\0\1\4\1\0\1\4"+
+ "\10\0\1\5\6\0\1\5\1\0\1\4\1\0\1\6"+
+ "\1\7\1\0\4\7\3\0\2\7\1\0\4\7\3\0"+
+ "\2\7\1\0\1\7\1\16\2\7\3\0\2\7\1\0"+
+ "\1\17\3\7\2\0\1\5\2\7\1\0\3\7\1\13"+
+ "\7\0\1\20\10\0\1\21\6\0\2\7\1\0\1\7"+
+ "\1\22\2\7\7\0\1\23\2\0";
+
+ private static int [] zzUnpacktrans() {
+ int [] result = new int[140];
int offset = 0;
- offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
+ offset = zzUnpacktrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
- private static int zzUnpackTrans(String packed, int offset, int [] result) {
+ private static int zzUnpacktrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
@@ -156,15 +211,16 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) {
};
/**
- * ZZ_ATTRIBUTE[aState] contains the attributes of state aState
+ * ZZ_ATTRIBUTE[aState] contains the attributes of state {@code aState}
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
- "\2\0\1\11\5\1";
+ "\2\0\1\11\4\1\1\11\7\1\1\11\1\0\1\1"+
+ "\1\11";
private static int [] zzUnpackAttribute() {
- int [] result = new int[8];
+ int [] result = new int[19];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
@@ -219,6 +275,20 @@ the source of the yytext() string */
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
+ /** Number of newlines encountered up to the start of the matched text. */
+ @SuppressWarnings("unused")
+ private int yyline;
+
+ /** Number of characters from the last newline up to the start of the matched text. */
+ @SuppressWarnings("unused")
+ protected int yycolumn;
+
+ /** Number of characters up to the start of the matched text. */
+ @SuppressWarnings("unused")
+ private long yychar;
+
+ /** Whether the scanner is currently at the beginning of a line. */
+
/**
* Creates a new scanner
@@ -230,26 +300,22 @@ public FeatureModelHighlightingLexer(java.io.Reader in) {
}
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
+ /** Returns the maximum size of the scanner buffer, which limits the size of tokens. */
+ private int zzMaxBufferLen() {
+ return Integer.MAX_VALUE;
+ }
+
+ /** Whether the scanner buffer can grow to accommodate a larger token. */
+ private boolean zzCanGrow() {
+ return true;
+ }
+
+ /**
+ * Translates raw input code points to DFA table row
*/
- private static char [] zzUnpackCMap(String packed) {
- int size = 0;
- for (int i = 0, length = packed.length(); i < length; i += 2) {
- size += packed.charAt(i);
- }
- char[] map = new char[size];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < packed.length()) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do map[j++] = value; while (--count > 0);
- }
- return map;
+ private static int zzCMap(int input) {
+ int offset = input & 255;
+ return offset == input ? ZZ_CMAP_BLOCKS[offset] : ZZ_CMAP_BLOCKS[ZZ_CMAP_TOP[input >> 8] | offset];
}
public final int getTokenStart() {
@@ -393,7 +459,8 @@ private void zzDoEOF() {
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
- public IElementType advance() throws java.io.IOException {
+ public IElementType advance() throws java.io.IOException
+ {
int zzInput;
int zzAction;
@@ -427,7 +494,7 @@ public IElementType advance() throws java.io.IOException {
while (true) {
if (zzCurrentPosL < zzEndReadL) {
- zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
+ zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
zzCurrentPosL += Character.charCount(zzInput);
}
else if (zzAtEOF) {
@@ -449,11 +516,11 @@ else if (zzAtEOF) {
break zzForAction;
}
else {
- zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
+ zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
zzCurrentPosL += Character.charCount(zzInput);
}
}
- int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ];
+ int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMap(zzInput) ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
@@ -472,31 +539,46 @@ else if (zzAtEOF) {
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
- zzDoEOF();
+ zzDoEOF();
return null;
}
else {
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 1:
+ case 1:
{ return TokenType.BAD_CHARACTER;
- }
- // fall through
- case 5: break;
- case 2:
- { yybegin(YYINITIAL); return FeatureModelTypes.CRLF;
- }
- // fall through
- case 6: break;
- case 3:
+ }
+ // fall through
+ case 8: break;
+ case 2:
{ yybegin(YYINITIAL); return FeatureModelTypes.INDENT;
- }
- // fall through
- case 7: break;
- case 4:
+ }
+ // fall through
+ case 9: break;
+ case 3:
+ { yybegin(YYINITIAL); return FeatureModelTypes.CRLF;
+ }
+ // fall through
+ case 10: break;
+ case 4:
{ yybegin(YYINITIAL); return FeatureModelTypes.FEATURENAME;
- }
- // fall through
- case 8: break;
+ }
+ // fall through
+ case 11: break;
+ case 5:
+ { return FeatureModelTypes.QUESTIONMARK;
+ }
+ // fall through
+ case 12: break;
+ case 6:
+ { return FeatureModelTypes.OR;
+ }
+ // fall through
+ case 13: break;
+ case 7:
+ { return FeatureModelTypes.XOR;
+ }
+ // fall through
+ case 14: break;
default:
zzScanError(ZZ_NO_MATCH);
}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/FeatureModelLexer.java b/src/main/gen/se/isselab/HAnS/featureModel/FeatureModelLexer.java
index fab5fb9a..2461ff7d 100644
--- a/src/main/gen/se/isselab/HAnS/featureModel/FeatureModelLexer.java
+++ b/src/main/gen/se/isselab/HAnS/featureModel/FeatureModelLexer.java
@@ -1,20 +1,31 @@
-/* The following code was generated by JFlex 1.7.0 tweaked for IntelliJ platform */
+// Generated by JFlex 1.9.2 http://jflex.de/ (tweaked for IntelliJ platform)
+// source: FeatureModel.flex
+/*
+Copyright 2021 Herman Jansson & Johan Martinson
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
package se.isselab.HAnS.featureModel;
+import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import se.isselab.HAnS.featureModel.psi.FeatureModelTypes;
-import com.intellij.lexer.FlexLexer;
import com.intellij.psi.TokenType;
import java.util.ArrayDeque;
import java.util.Deque;
-/**
- * This class is a scanner generated by
- * JFlex 1.7.0
- * from the specification file FeatureModel.flex
- */
public class FeatureModelLexer implements FlexLexer {
/** This character denotes the end of file */
@@ -28,6 +39,17 @@ public class FeatureModelLexer implements FlexLexer {
public static final int indent = 2;
public static final int feature = 4;
public static final int dedent = 6;
+ public static final int questionmark = 8;
+ public static final int or1 = 10;
+ public static final int or2 = 12;
+ public static final int xor1 = 14;
+ public static final int xor2 = 16;
+ public static final int xor3 = 18;
+ public static final int returFeaturename = 20;
+ public static final int returnOr = 22;
+ public static final int returnOrDedent = 24;
+ public static final int returnXor = 26;
+ public static final int returnXorDedent = 28;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
@@ -35,43 +57,82 @@ public class FeatureModelLexer implements FlexLexer {
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
- private static final int ZZ_LEXSTATE[] = {
- 0, 0, 1, 1, 2, 2, 3, 3
+ private static final int ZZ_LEXSTATE[] = {
+ 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
+ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14
};
- /**
- * Translates characters to character classes
- * Chosen bits are [9, 6, 6]
- * Total runtime size is 1568 bytes
+ /**
+ * Top-level table for translating characters to character classes
*/
- public static int ZZ_CMAP(int ch) {
- return ZZ_CMAP_A[(ZZ_CMAP_Y[ZZ_CMAP_Z[ch>>12]|((ch>>6)&0x3f)]<<6)|(ch&0x3f)];
+ private static final int [] ZZ_CMAP_TOP = zzUnpackcmap_top();
+
+ private static final String ZZ_CMAP_TOP_PACKED_0 =
+ "\1\0\37\u0100\1\u0200\267\u0100\10\u0300\u1020\u0100";
+
+ private static int [] zzUnpackcmap_top() {
+ int [] result = new int[4352];
+ int offset = 0;
+ offset = zzUnpackcmap_top(ZZ_CMAP_TOP_PACKED_0, offset, result);
+ return result;
+ }
+
+ private static int zzUnpackcmap_top(String packed, int offset, int [] result) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ do result[j++] = value; while (--count > 0);
+ }
+ return j;
}
- /* The ZZ_CMAP_Z table has 272 entries */
- static final char ZZ_CMAP_Z[] = zzUnpackCMap(
- "\1\0\1\100\1\200\u010d\100");
- /* The ZZ_CMAP_Y table has 192 entries */
- static final char ZZ_CMAP_Y[] = zzUnpackCMap(
- "\1\0\1\1\1\2\175\3\1\4\77\3");
+ /**
+ * Second-level tables for translating characters to character classes
+ */
+ private static final int [] ZZ_CMAP_BLOCKS = zzUnpackcmap_blocks();
+
+ private static final String ZZ_CMAP_BLOCKS_PACKED_0 =
+ "\11\0\1\1\1\2\2\3\1\2\22\0\1\4\6\0"+
+ "\1\5\3\0\1\6\4\0\12\6\5\0\1\7\1\0"+
+ "\32\6\4\0\1\6\1\0\16\6\1\10\2\6\1\11"+
+ "\5\6\1\12\2\6\1\0\1\13\10\0\1\3\u01a2\0"+
+ "\2\3\326\0\u0100\3";
+
+ private static int [] zzUnpackcmap_blocks() {
+ int [] result = new int[1024];
+ int offset = 0;
+ offset = zzUnpackcmap_blocks(ZZ_CMAP_BLOCKS_PACKED_0, offset, result);
+ return result;
+ }
- /* The ZZ_CMAP_A table has 320 entries */
- static final char ZZ_CMAP_A[] = zzUnpackCMap(
- "\11\0\1\3\1\1\2\7\1\1\22\0\1\2\6\0\1\6\3\0\1\4\4\0\12\4\7\0\32\4\4\0\1\4\1"+
- "\0\32\4\1\0\1\5\10\0\1\7\242\0\2\7\26\0");
+ private static int zzUnpackcmap_blocks(String packed, int offset, int [] result) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ do result[j++] = value; while (--count > 0);
+ }
+ return j;
+ }
- /**
+ /**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
- "\4\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+
- "\1\10";
+ "\17\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+
+ "\1\10\1\11\1\12\1\13\1\14\1\15\1\16\1\17"+
+ "\1\20\1\21\1\22\1\23\1\24\1\25\1\26\1\27";
private static int [] zzUnpackAction() {
- int [] result = new int[12];
+ int [] result = new int[38];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
@@ -90,17 +151,20 @@ private static int zzUnpackAction(String packed, int offset, int [] result) {
}
- /**
+ /**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
- "\0\0\0\10\0\20\0\30\0\40\0\40\0\50\0\40"+
- "\0\40\0\40\0\60\0\40";
+ "\0\0\0\14\0\30\0\44\0\60\0\74\0\110\0\124"+
+ "\0\140\0\154\0\170\0\204\0\220\0\234\0\250\0\264"+
+ "\0\264\0\264\0\300\0\264\0\264\0\264\0\264\0\264"+
+ "\0\314\0\264\0\264\0\264\0\264\0\264\0\264\0\264"+
+ "\0\264\0\264\0\264\0\264\0\264\0\264";
private static int [] zzUnpackRowMap() {
- int [] result = new int[12];
+ int [] result = new int[38];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
@@ -109,7 +173,7 @@ private static int zzUnpackAction(String packed, int offset, int [] result) {
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
- int l = packed.length();
+ int l = packed.length() - 1;
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
@@ -117,25 +181,29 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) {
return j;
}
- /**
+ /**
* The transition table of the DFA
*/
- private static final int [] ZZ_TRANS = zzUnpackTrans();
+ private static final int [] ZZ_TRANS = zzUnpacktrans();
private static final String ZZ_TRANS_PACKED_0 =
- "\1\5\1\6\5\5\1\6\1\0\1\7\1\10\1\11"+
- "\1\12\1\7\1\10\1\0\4\6\3\13\1\6\1\14"+
- "\1\6\5\14\1\6\11\0\1\7\3\0\1\7\6\0"+
- "\3\13\1\0";
-
- private static int [] zzUnpackTrans() {
- int [] result = new int[56];
+ "\2\20\2\21\10\20\1\0\1\22\1\23\1\0\2\24"+
+ "\1\25\1\26\1\27\1\25\1\30\1\23\5\21\2\31"+
+ "\1\21\4\31\2\32\2\21\10\32\14\21\1\25\2\33"+
+ "\6\25\1\34\1\25\1\33\5\35\2\25\1\35\5\25"+
+ "\2\36\5\25\1\37\2\25\1\36\1\25\2\33\6\25"+
+ "\1\40\1\25\1\33\5\41\2\25\1\41\4\25\14\42"+
+ "\14\43\14\44\14\45\14\46\16\0\1\23\10\0\1\23"+
+ "\5\0\2\31\1\0\4\31";
+
+ private static int [] zzUnpacktrans() {
+ int [] result = new int[216];
int offset = 0;
- offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
+ offset = zzUnpacktrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
- private static int zzUnpackTrans(String packed, int offset, int [] result) {
+ private static int zzUnpacktrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
@@ -162,15 +230,15 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) {
};
/**
- * ZZ_ATTRIBUTE[aState] contains the attributes of state aState
+ * ZZ_ATTRIBUTE[aState] contains the attributes of state {@code aState}
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
- "\4\0\2\11\1\1\3\11\1\1\1\11";
+ "\17\0\3\11\1\1\5\11\1\1\15\11";
private static int [] zzUnpackAttribute() {
- int [] result = new int[12];
+ int [] result = new int[38];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
@@ -225,16 +293,79 @@ the source of the yytext() string */
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
+ /** Number of newlines encountered up to the start of the matched text. */
+ @SuppressWarnings("unused")
+ private int yyline;
+
+ /** Number of characters from the last newline up to the start of the matched text. */
+ @SuppressWarnings("unused")
+ protected int yycolumn;
+
+ /** Number of characters up to the start of the matched text. */
+ @SuppressWarnings("unused")
+ private long yychar;
+
+ /** Whether the scanner is currently at the beginning of a line. */
+
/* user code: */
int current_line_indent = 0;
- int indent_level = 0;
- int indent_caller = indent;
+ int indent_level = 0;
+ int indent_caller = indent;
- final int TAB_WIDTH = 4;
+ final int TAB_WIDTH = 4;
- int test = 1;
+ int test = 1;
- Deque indent_levels = new ArrayDeque();
+ Deque indent_levels = new ArrayDeque();
+ private IElementType goIntoFeaturename() {
+ if(current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(feature);
+ return FeatureModelTypes.INDENT;
+ }
+ else if(current_line_indent < indent_levels.peek()) {
+ indent_levels.pop();
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(feature);
+ }
+ else if(current_line_indent != indent_levels.peek()) {
+ yypushback(1);
+ yybegin(dedent);
+ return FeatureModelTypes.DEDENT;
+ }
+ else {
+ yypushback(1);
+ yybegin(feature);
+ return FeatureModelTypes.DEDENT;
+ }
+ }
+ else if (current_line_indent == 0){
+ yypushback(1);
+ yybegin(feature);
+ }
+ else {
+ yypushback(1);
+ yybegin(feature);
+ return FeatureModelTypes.CRLF;
+ }
+ return null;
+ }
+ private IElementType goToDedent(int nextStae) {
+ indent_levels.pop();
+ if(current_line_indent != indent_levels.peek()) {
+ yypushback(1);
+ return FeatureModelTypes.DEDENT;
+ }
+ else {
+ yypushback(1);
+ yybegin(nextStae);
+ return FeatureModelTypes.DEDENT;
+ }
+ }
+ private void print(String str) {System.out.println(str);}
/**
@@ -247,26 +378,22 @@ public FeatureModelLexer(java.io.Reader in) {
}
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
+ /** Returns the maximum size of the scanner buffer, which limits the size of tokens. */
+ private int zzMaxBufferLen() {
+ return Integer.MAX_VALUE;
+ }
+
+ /** Whether the scanner buffer can grow to accommodate a larger token. */
+ private boolean zzCanGrow() {
+ return true;
+ }
+
+ /**
+ * Translates raw input code points to DFA table row
*/
- private static char [] zzUnpackCMap(String packed) {
- int size = 0;
- for (int i = 0, length = packed.length(); i < length; i += 2) {
- size += packed.charAt(i);
- }
- char[] map = new char[size];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < packed.length()) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do map[j++] = value; while (--count > 0);
- }
- return map;
+ private static int zzCMap(int input) {
+ int offset = input & 255;
+ return offset == input ? ZZ_CMAP_BLOCKS[offset] : ZZ_CMAP_BLOCKS[ZZ_CMAP_TOP[input >> 8] | offset];
}
public final int getTokenStart() {
@@ -398,8 +525,8 @@ public void yypushback(int number) {
private void zzDoEOF() {
if (!zzEOFDone) {
zzEOFDone = true;
- return;
-
+
+ return;
}
}
@@ -411,7 +538,8 @@ private void zzDoEOF() {
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
- public IElementType advance() throws java.io.IOException {
+ public IElementType advance() throws java.io.IOException
+ {
int zzInput;
int zzAction;
@@ -445,7 +573,7 @@ public IElementType advance() throws java.io.IOException {
while (true) {
if (zzCurrentPosL < zzEndReadL) {
- zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
+ zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
zzCurrentPosL += Character.charCount(zzInput);
}
else if (zzAtEOF) {
@@ -467,11 +595,11 @@ else if (zzAtEOF) {
break zzForAction;
}
else {
- zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
+ zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
zzCurrentPosL += Character.charCount(zzInput);
}
}
- int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ];
+ int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMap(zzInput) ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
@@ -490,8 +618,8 @@ else if (zzAtEOF) {
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
- zzDoEOF();
- switch (zzLexicalState) {
+ zzDoEOF();
+ switch (zzLexicalState) {
case indent: {
if (indent_levels.peek() != 0) {
indent_levels.pop();
@@ -501,95 +629,261 @@ else if (zzAtEOF) {
yybegin(YYINITIAL);
}
} // fall though
- case 13: break;
+ case 39: break;
+ case or1: {
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
+ }
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ } // fall though
+ case 40: break;
+ case or2: {
+ yybegin(indent);
+ return FeatureModelTypes.OR;
+ } // fall though
+ case 41: break;
+ case xor1: {
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
+ }
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ } // fall though
+ case 42: break;
+ case xor2: {
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
+ }
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ } // fall though
+ case 43: break;
+ case xor3: {
+ yybegin(indent);
+ return FeatureModelTypes.XOR;
+ } // fall though
+ case 44: break;
+ case returFeaturename: {
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ } // fall though
+ case 45: break;
default:
return null;
}
}
else {
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 1:
+ case 1:
{ yypushback(1); indent_levels.push(0); yybegin(feature);
- }
- // fall through
- case 9: break;
- case 2:
+ }
+ // fall through
+ case 24: break;
+ case 2:
{ return TokenType.BAD_CHARACTER;
- }
- // fall through
- case 10: break;
- case 3:
+ }
+ // fall through
+ case 25: break;
+ case 3:
+ { current_line_indent = (current_line_indent + TAB_WIDTH) & ~(TAB_WIDTH-1);
+ }
+ // fall through
+ case 26: break;
+ case 4:
{ current_line_indent = 0; return FeatureModelTypes.CRLF;
- }
- // fall through
- case 11: break;
- case 4:
+ }
+ // fall through
+ case 27: break;
+ case 5:
{ current_line_indent++;
- }
- // fall through
- case 12: break;
- case 5:
- { current_line_indent = (current_line_indent + TAB_WIDTH) & ~(TAB_WIDTH-1);
- }
- // fall through
- case 13: break;
- case 6:
+ }
+ // fall through
+ case 28: break;
+ case 6:
+ { IElementType result = goIntoFeaturename();
+ if (result != null) return result;
+ }
+ // fall through
+ case 29: break;
+ case 7:
+ { yybegin(indent);
+ return FeatureModelTypes.QUESTIONMARK;
+ }
+ // fall through
+ case 30: break;
+ case 8:
+ { yybegin(or1);
+ }
+ // fall through
+ case 31: break;
+ case 9:
+ { yybegin(xor1);
+ }
+ // fall through
+ case 32: break;
+ case 10:
+ { yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+ // fall through
+ case 33: break;
+ case 11:
+ { return goToDedent(feature);
+ }
+ // fall through
+ case 34: break;
+ case 12:
+ { if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
+ }
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+ // fall through
+ case 35: break;
+ case 13:
+ { yybegin(or2);
+ }
+ // fall through
+ case 36: break;
+ case 14:
+ { if(current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returnOr);
+ return FeatureModelTypes.INDENT;
+ }
+ else if(current_line_indent < indent_levels.peek()) {
+ indent_levels.pop();
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returnOr);
+ }
+ else if(current_line_indent != indent_levels.peek()) {
+ yypushback(1);
+ yybegin(returnOrDedent);
+ return FeatureModelTypes.DEDENT;
+ }
+ else {
+ yypushback(1);
+ yybegin(returnOr);
+ return FeatureModelTypes.DEDENT;
+ }
+ }
+ else if (current_line_indent == 0){
+ yypushback(1);
+ yybegin(returnOr);
+ }
+ else {
+ yypushback(1);
+ yybegin(returnOr);
+ return FeatureModelTypes.CRLF;
+ }
+ }
+ // fall through
+ case 37: break;
+ case 15:
+ { if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
+ }
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+ // fall through
+ case 38: break;
+ case 16:
+ { yybegin(xor2);
+ }
+ // fall through
+ case 39: break;
+ case 17:
+ { yybegin(xor3);
+ }
+ // fall through
+ case 40: break;
+ case 18:
{ if(current_line_indent > indent_levels.peek()) {
- indent_levels.push(current_line_indent);
- yypushback(1);
- yybegin(feature);
- return FeatureModelTypes.INDENT;
- }
- else if(current_line_indent < indent_levels.peek()) {
- indent_levels.pop();
- if (current_line_indent > indent_levels.peek()) {
indent_levels.push(current_line_indent);
yypushback(1);
- yybegin(feature);
+ yybegin(returnXor);
+ return FeatureModelTypes.INDENT;
+ }
+ else if(current_line_indent < indent_levels.peek()) {
+ indent_levels.pop();
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returnXor);
+ }
+ else if(current_line_indent != indent_levels.peek()) {
+ yypushback(1);
+ yybegin(returnXorDedent);
+ return FeatureModelTypes.DEDENT;
+ }
+ else {
+ yypushback(1);
+ yybegin(returnXor);
+ return FeatureModelTypes.DEDENT;
+ }
}
- else if(current_line_indent != indent_levels.peek()) {
+ else if (current_line_indent == 0){
yypushback(1);
- yybegin(dedent);
- return FeatureModelTypes.DEDENT;
+ yybegin(returnXor);
}
else {
yypushback(1);
- yybegin(feature);
- return FeatureModelTypes.DEDENT;
+ yybegin(returnXor);
+ return FeatureModelTypes.CRLF;
}
- }
- else if (current_line_indent == 0){
- yypushback(1);
- yybegin(feature);
- }
- else {
- yypushback(1);
- yybegin(feature);
- return FeatureModelTypes.CRLF;
- }
- }
- // fall through
- case 14: break;
- case 7:
+ }
+ // fall through
+ case 41: break;
+ case 19:
{ yybegin(indent);
- return FeatureModelTypes.FEATURENAME;
- }
- // fall through
- case 15: break;
- case 8:
- { indent_levels.pop();
- if(current_line_indent != indent_levels.peek()) {
- yypushback(1);
- return FeatureModelTypes.DEDENT;
- }
- else {
- yypushback(1);
- yybegin(feature);
- return FeatureModelTypes.DEDENT;
- }
- }
- // fall through
- case 16: break;
+ return FeatureModelTypes.FEATURENAME;
+ }
+ // fall through
+ case 42: break;
+ case 20:
+ { yypushback(1);
+ yybegin(indent);
+ current_line_indent += 2;
+ return FeatureModelTypes.OR;
+ }
+ // fall through
+ case 43: break;
+ case 21:
+ { return goToDedent(returnOr);
+ }
+ // fall through
+ case 44: break;
+ case 22:
+ { yypushback(1);
+ yybegin(indent);
+ current_line_indent += 3;
+ return FeatureModelTypes.XOR;
+ }
+ // fall through
+ case 45: break;
+ case 23:
+ { return goToDedent(returnXor);
+ }
+ // fall through
+ case 46: break;
default:
zzScanError(ZZ_NO_MATCH);
}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/parser/FeatureModelParser.java b/src/main/gen/se/isselab/HAnS/featureModel/parser/FeatureModelParser.java
index 82f94aeb..01ce92f7 100644
--- a/src/main/gen/se/isselab/HAnS/featureModel/parser/FeatureModelParser.java
+++ b/src/main/gen/se/isselab/HAnS/featureModel/parser/FeatureModelParser.java
@@ -36,7 +36,138 @@ static boolean parse_root_(IElementType t, PsiBuilder b, int l) {
}
/* ********************************************************** */
- // FEATURENAME (CRLF+ ((INDENT) feature* DEDENT)?)?
+ // feature | LOGIC
+ public static boolean COMPONENT(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "COMPONENT")) return false;
+ boolean r;
+ Marker m = enter_section_(b, l, _NONE_, COMPONENT, "");
+ r = feature(b, l + 1);
+ if (!r) r = LOGIC(b, l + 1);
+ exit_section_(b, l, m, r, false, null);
+ return r;
+ }
+
+ /* ********************************************************** */
+ // (OR_BLOCK) | (XOR_BLOCK)
+ public static boolean LOGIC(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "LOGIC")) return false;
+ if (!nextTokenIs(b, "", OR, XOR)) return false;
+ boolean r;
+ Marker m = enter_section_(b, l, _NONE_, LOGIC, "");
+ r = LOGIC_0(b, l + 1);
+ if (!r) r = LOGIC_1(b, l + 1);
+ exit_section_(b, l, m, r, false, null);
+ return r;
+ }
+
+ // (OR_BLOCK)
+ private static boolean LOGIC_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "LOGIC_0")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = OR_BLOCK(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ // (XOR_BLOCK)
+ private static boolean LOGIC_1(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "LOGIC_1")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = XOR_BLOCK(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ /* ********************************************************** */
+ // OR (SUB_LOGIC)
+ public static boolean OR_BLOCK(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "OR_BLOCK")) return false;
+ if (!nextTokenIs(b, OR)) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = consumeToken(b, OR);
+ r = r && OR_BLOCK_1(b, l + 1);
+ exit_section_(b, m, OR_BLOCK, r);
+ return r;
+ }
+
+ // (SUB_LOGIC)
+ private static boolean OR_BLOCK_1(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "OR_BLOCK_1")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = SUB_LOGIC(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ /* ********************************************************** */
+ // INDENT COMPONENT (COMPONENT)+ DEDENT
+ public static boolean SUB_LOGIC(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "SUB_LOGIC")) return false;
+ if (!nextTokenIs(b, INDENT)) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = consumeToken(b, INDENT);
+ r = r && COMPONENT(b, l + 1);
+ r = r && SUB_LOGIC_2(b, l + 1);
+ r = r && consumeToken(b, DEDENT);
+ exit_section_(b, m, SUB_LOGIC, r);
+ return r;
+ }
+
+ // (COMPONENT)+
+ private static boolean SUB_LOGIC_2(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "SUB_LOGIC_2")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = SUB_LOGIC_2_0(b, l + 1);
+ while (r) {
+ int c = current_position_(b);
+ if (!SUB_LOGIC_2_0(b, l + 1)) break;
+ if (!empty_element_parsed_guard_(b, "SUB_LOGIC_2", c)) break;
+ }
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ // (COMPONENT)
+ private static boolean SUB_LOGIC_2_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "SUB_LOGIC_2_0")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = COMPONENT(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ /* ********************************************************** */
+ // XOR (SUB_LOGIC)
+ public static boolean XOR_BLOCK(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "XOR_BLOCK")) return false;
+ if (!nextTokenIs(b, XOR)) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = consumeToken(b, XOR);
+ r = r && XOR_BLOCK_1(b, l + 1);
+ exit_section_(b, m, XOR_BLOCK, r);
+ return r;
+ }
+
+ // (SUB_LOGIC)
+ private static boolean XOR_BLOCK_1(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "XOR_BLOCK_1")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = SUB_LOGIC(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
+ /* ********************************************************** */
+ // FEATURENAME (QUESTIONMARK)? (CRLF+ ((INDENT) (COMPONENT)* DEDENT)?)?
public static boolean feature(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "feature")) return false;
if (!nextTokenIs(b, FEATURENAME)) return false;
@@ -44,73 +175,91 @@ public static boolean feature(PsiBuilder b, int l) {
Marker m = enter_section_(b);
r = consumeToken(b, FEATURENAME);
r = r && feature_1(b, l + 1);
+ r = r && feature_2(b, l + 1);
exit_section_(b, m, FEATURE, r);
return r;
}
- // (CRLF+ ((INDENT) feature* DEDENT)?)?
+ // (QUESTIONMARK)?
private static boolean feature_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "feature_1")) return false;
- feature_1_0(b, l + 1);
+ consumeToken(b, QUESTIONMARK);
return true;
}
- // CRLF+ ((INDENT) feature* DEDENT)?
- private static boolean feature_1_0(PsiBuilder b, int l) {
- if (!recursion_guard_(b, l, "feature_1_0")) return false;
+ // (CRLF+ ((INDENT) (COMPONENT)* DEDENT)?)?
+ private static boolean feature_2(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "feature_2")) return false;
+ feature_2_0(b, l + 1);
+ return true;
+ }
+
+ // CRLF+ ((INDENT) (COMPONENT)* DEDENT)?
+ private static boolean feature_2_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "feature_2_0")) return false;
boolean r;
Marker m = enter_section_(b);
- r = feature_1_0_0(b, l + 1);
- r = r && feature_1_0_1(b, l + 1);
+ r = feature_2_0_0(b, l + 1);
+ r = r && feature_2_0_1(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
// CRLF+
- private static boolean feature_1_0_0(PsiBuilder b, int l) {
- if (!recursion_guard_(b, l, "feature_1_0_0")) return false;
+ private static boolean feature_2_0_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "feature_2_0_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, CRLF);
while (r) {
int c = current_position_(b);
if (!consumeToken(b, CRLF)) break;
- if (!empty_element_parsed_guard_(b, "feature_1_0_0", c)) break;
+ if (!empty_element_parsed_guard_(b, "feature_2_0_0", c)) break;
}
exit_section_(b, m, null, r);
return r;
}
- // ((INDENT) feature* DEDENT)?
- private static boolean feature_1_0_1(PsiBuilder b, int l) {
- if (!recursion_guard_(b, l, "feature_1_0_1")) return false;
- feature_1_0_1_0(b, l + 1);
+ // ((INDENT) (COMPONENT)* DEDENT)?
+ private static boolean feature_2_0_1(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "feature_2_0_1")) return false;
+ feature_2_0_1_0(b, l + 1);
return true;
}
- // (INDENT) feature* DEDENT
- private static boolean feature_1_0_1_0(PsiBuilder b, int l) {
- if (!recursion_guard_(b, l, "feature_1_0_1_0")) return false;
+ // (INDENT) (COMPONENT)* DEDENT
+ private static boolean feature_2_0_1_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "feature_2_0_1_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, INDENT);
- r = r && feature_1_0_1_0_1(b, l + 1);
+ r = r && feature_2_0_1_0_1(b, l + 1);
r = r && consumeToken(b, DEDENT);
exit_section_(b, m, null, r);
return r;
}
- // feature*
- private static boolean feature_1_0_1_0_1(PsiBuilder b, int l) {
- if (!recursion_guard_(b, l, "feature_1_0_1_0_1")) return false;
+ // (COMPONENT)*
+ private static boolean feature_2_0_1_0_1(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "feature_2_0_1_0_1")) return false;
while (true) {
int c = current_position_(b);
- if (!feature(b, l + 1)) break;
- if (!empty_element_parsed_guard_(b, "feature_1_0_1_0_1", c)) break;
+ if (!feature_2_0_1_0_1_0(b, l + 1)) break;
+ if (!empty_element_parsed_guard_(b, "feature_2_0_1_0_1", c)) break;
}
return true;
}
+ // (COMPONENT)
+ private static boolean feature_2_0_1_0_1_0(PsiBuilder b, int l) {
+ if (!recursion_guard_(b, l, "feature_2_0_1_0_1_0")) return false;
+ boolean r;
+ Marker m = enter_section_(b);
+ r = COMPONENT(b, l + 1);
+ exit_section_(b, m, null, r);
+ return r;
+ }
+
/* ********************************************************** */
// (feature (feature)?)?
static boolean featureModelFile(PsiBuilder b, int l) {
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelComponent.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelComponent.java
new file mode 100644
index 00000000..db9e5947
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelComponent.java
@@ -0,0 +1,16 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.psi.PsiElement;
+
+public interface FeatureModelComponent extends PsiElement {
+
+ @Nullable
+ FeatureModelLogic getLogic();
+
+ @Nullable
+ FeatureModelFeature getFeature();
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelFeature.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelFeature.java
index 4855bdbb..864ac077 100644
--- a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelFeature.java
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelFeature.java
@@ -11,7 +11,7 @@
public interface FeatureModelFeature extends FeatureAnnotationNamedElement {
@NotNull
- List getFeatureList();
+ List getComponentList();
String getLPQText();
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelLogic.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelLogic.java
new file mode 100644
index 00000000..8412cbd5
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelLogic.java
@@ -0,0 +1,16 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.psi.PsiElement;
+
+public interface FeatureModelLogic extends PsiElement {
+
+ @Nullable
+ FeatureModelOrBlock getOrBlock();
+
+ @Nullable
+ FeatureModelXorBlock getXorBlock();
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelOrBlock.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelOrBlock.java
new file mode 100644
index 00000000..1b29ea67
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelOrBlock.java
@@ -0,0 +1,13 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.psi.PsiElement;
+
+public interface FeatureModelOrBlock extends PsiElement {
+
+ @NotNull
+ FeatureModelSubLogic getSubLogic();
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelSubLogic.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelSubLogic.java
new file mode 100644
index 00000000..17d89df8
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelSubLogic.java
@@ -0,0 +1,13 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.psi.PsiElement;
+
+public interface FeatureModelSubLogic extends PsiElement {
+
+ @NotNull
+ List getComponentList();
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelTypes.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelTypes.java
index cd318ec0..5965c83c 100644
--- a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelTypes.java
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelTypes.java
@@ -8,19 +8,42 @@
public interface FeatureModelTypes {
+ IElementType COMPONENT = new FeatureModelElementType("COMPONENT");
IElementType FEATURE = new FeatureModelElementType("FEATURE");
+ IElementType LOGIC = new FeatureModelElementType("LOGIC");
+ IElementType OR_BLOCK = new FeatureModelElementType("OR_BLOCK");
+ IElementType SUB_LOGIC = new FeatureModelElementType("SUB_LOGIC");
+ IElementType XOR_BLOCK = new FeatureModelElementType("XOR_BLOCK");
IElementType CRLF = new FeatureModelTokenType("CRLF");
IElementType DEDENT = new FeatureModelTokenType("DEDENT");
IElementType FEATURENAME = new FeatureModelTokenType("FEATURENAME");
IElementType INDENT = new FeatureModelTokenType("INDENT");
+ IElementType OR = new FeatureModelTokenType("OR");
+ IElementType QUESTIONMARK = new FeatureModelTokenType("QUESTIONMARK");
+ IElementType XOR = new FeatureModelTokenType("XOR");
class Factory {
public static PsiElement createElement(ASTNode node) {
IElementType type = node.getElementType();
- if (type == FEATURE) {
+ if (type == COMPONENT) {
+ return new FeatureModelComponentImpl(node);
+ }
+ else if (type == FEATURE) {
return new FeatureModelFeatureImpl(node);
}
+ else if (type == LOGIC) {
+ return new FeatureModelLogicImpl(node);
+ }
+ else if (type == OR_BLOCK) {
+ return new FeatureModelOrBlockImpl(node);
+ }
+ else if (type == SUB_LOGIC) {
+ return new FeatureModelSubLogicImpl(node);
+ }
+ else if (type == XOR_BLOCK) {
+ return new FeatureModelXorBlockImpl(node);
+ }
throw new AssertionError("Unknown element type: " + type);
}
}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelVisitor.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelVisitor.java
index e5b12d05..736e8454 100644
--- a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelVisitor.java
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelVisitor.java
@@ -8,6 +8,26 @@
public class FeatureModelVisitor extends PsiElementVisitor {
+ public void visitComponent(@NotNull FeatureModelComponent o) {
+ visitPsiElement(o);
+ }
+
+ public void visitLogic(@NotNull FeatureModelLogic o) {
+ visitPsiElement(o);
+ }
+
+ public void visitOrBlock(@NotNull FeatureModelOrBlock o) {
+ visitPsiElement(o);
+ }
+
+ public void visitSubLogic(@NotNull FeatureModelSubLogic o) {
+ visitPsiElement(o);
+ }
+
+ public void visitXorBlock(@NotNull FeatureModelXorBlock o) {
+ visitPsiElement(o);
+ }
+
public void visitFeature(@NotNull FeatureModelFeature o) {
visitFeatureAnnotationNamedElement(o);
}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelXorBlock.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelXorBlock.java
new file mode 100644
index 00000000..65627d80
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/FeatureModelXorBlock.java
@@ -0,0 +1,13 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.psi.PsiElement;
+
+public interface FeatureModelXorBlock extends PsiElement {
+
+ @NotNull
+ FeatureModelSubLogic getSubLogic();
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelComponentImpl.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelComponentImpl.java
new file mode 100644
index 00000000..e418de72
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelComponentImpl.java
@@ -0,0 +1,42 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi.impl;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.lang.ASTNode;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.util.PsiTreeUtil;
+import static se.isselab.HAnS.featureModel.psi.FeatureModelTypes.*;
+import com.intellij.extapi.psi.ASTWrapperPsiElement;
+import se.isselab.HAnS.featureModel.psi.*;
+
+public class FeatureModelComponentImpl extends ASTWrapperPsiElement implements FeatureModelComponent {
+
+ public FeatureModelComponentImpl(@NotNull ASTNode node) {
+ super(node);
+ }
+
+ public void accept(@NotNull FeatureModelVisitor visitor) {
+ visitor.visitComponent(this);
+ }
+
+ @Override
+ public void accept(@NotNull PsiElementVisitor visitor) {
+ if (visitor instanceof FeatureModelVisitor) accept((FeatureModelVisitor)visitor);
+ else super.accept(visitor);
+ }
+
+ @Override
+ @Nullable
+ public FeatureModelLogic getLogic() {
+ return findChildByClass(FeatureModelLogic.class);
+ }
+
+ @Override
+ @Nullable
+ public FeatureModelFeature getFeature() {
+ return findChildByClass(FeatureModelFeature.class);
+ }
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelFeatureImpl.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelFeatureImpl.java
index 47efb102..67c1033c 100644
--- a/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelFeatureImpl.java
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelFeatureImpl.java
@@ -31,8 +31,8 @@ public void accept(@NotNull PsiElementVisitor visitor) {
@Override
@NotNull
- public List getFeatureList() {
- return PsiTreeUtil.getChildrenOfTypeAsList(this, FeatureModelFeature.class);
+ public List getComponentList() {
+ return PsiTreeUtil.getChildrenOfTypeAsList(this, FeatureModelComponent.class);
}
@Override
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelLogicImpl.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelLogicImpl.java
new file mode 100644
index 00000000..ac4db7b3
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelLogicImpl.java
@@ -0,0 +1,42 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi.impl;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.lang.ASTNode;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.util.PsiTreeUtil;
+import static se.isselab.HAnS.featureModel.psi.FeatureModelTypes.*;
+import com.intellij.extapi.psi.ASTWrapperPsiElement;
+import se.isselab.HAnS.featureModel.psi.*;
+
+public class FeatureModelLogicImpl extends ASTWrapperPsiElement implements FeatureModelLogic {
+
+ public FeatureModelLogicImpl(@NotNull ASTNode node) {
+ super(node);
+ }
+
+ public void accept(@NotNull FeatureModelVisitor visitor) {
+ visitor.visitLogic(this);
+ }
+
+ @Override
+ public void accept(@NotNull PsiElementVisitor visitor) {
+ if (visitor instanceof FeatureModelVisitor) accept((FeatureModelVisitor)visitor);
+ else super.accept(visitor);
+ }
+
+ @Override
+ @Nullable
+ public FeatureModelOrBlock getOrBlock() {
+ return findChildByClass(FeatureModelOrBlock.class);
+ }
+
+ @Override
+ @Nullable
+ public FeatureModelXorBlock getXorBlock() {
+ return findChildByClass(FeatureModelXorBlock.class);
+ }
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelOrBlockImpl.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelOrBlockImpl.java
new file mode 100644
index 00000000..a479d431
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelOrBlockImpl.java
@@ -0,0 +1,36 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi.impl;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.lang.ASTNode;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.util.PsiTreeUtil;
+import static se.isselab.HAnS.featureModel.psi.FeatureModelTypes.*;
+import com.intellij.extapi.psi.ASTWrapperPsiElement;
+import se.isselab.HAnS.featureModel.psi.*;
+
+public class FeatureModelOrBlockImpl extends ASTWrapperPsiElement implements FeatureModelOrBlock {
+
+ public FeatureModelOrBlockImpl(@NotNull ASTNode node) {
+ super(node);
+ }
+
+ public void accept(@NotNull FeatureModelVisitor visitor) {
+ visitor.visitOrBlock(this);
+ }
+
+ @Override
+ public void accept(@NotNull PsiElementVisitor visitor) {
+ if (visitor instanceof FeatureModelVisitor) accept((FeatureModelVisitor)visitor);
+ else super.accept(visitor);
+ }
+
+ @Override
+ @NotNull
+ public FeatureModelSubLogic getSubLogic() {
+ return findNotNullChildByClass(FeatureModelSubLogic.class);
+ }
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelSubLogicImpl.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelSubLogicImpl.java
new file mode 100644
index 00000000..080c2d0a
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelSubLogicImpl.java
@@ -0,0 +1,36 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi.impl;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.lang.ASTNode;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.util.PsiTreeUtil;
+import static se.isselab.HAnS.featureModel.psi.FeatureModelTypes.*;
+import com.intellij.extapi.psi.ASTWrapperPsiElement;
+import se.isselab.HAnS.featureModel.psi.*;
+
+public class FeatureModelSubLogicImpl extends ASTWrapperPsiElement implements FeatureModelSubLogic {
+
+ public FeatureModelSubLogicImpl(@NotNull ASTNode node) {
+ super(node);
+ }
+
+ public void accept(@NotNull FeatureModelVisitor visitor) {
+ visitor.visitSubLogic(this);
+ }
+
+ @Override
+ public void accept(@NotNull PsiElementVisitor visitor) {
+ if (visitor instanceof FeatureModelVisitor) accept((FeatureModelVisitor)visitor);
+ else super.accept(visitor);
+ }
+
+ @Override
+ @NotNull
+ public List getComponentList() {
+ return PsiTreeUtil.getChildrenOfTypeAsList(this, FeatureModelComponent.class);
+ }
+
+}
diff --git a/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelXorBlockImpl.java b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelXorBlockImpl.java
new file mode 100644
index 00000000..d6f9f93a
--- /dev/null
+++ b/src/main/gen/se/isselab/HAnS/featureModel/psi/impl/FeatureModelXorBlockImpl.java
@@ -0,0 +1,36 @@
+// This is a generated file. Not intended for manual editing.
+package se.isselab.HAnS.featureModel.psi.impl;
+
+import java.util.List;
+import org.jetbrains.annotations.*;
+import com.intellij.lang.ASTNode;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.util.PsiTreeUtil;
+import static se.isselab.HAnS.featureModel.psi.FeatureModelTypes.*;
+import com.intellij.extapi.psi.ASTWrapperPsiElement;
+import se.isselab.HAnS.featureModel.psi.*;
+
+public class FeatureModelXorBlockImpl extends ASTWrapperPsiElement implements FeatureModelXorBlock {
+
+ public FeatureModelXorBlockImpl(@NotNull ASTNode node) {
+ super(node);
+ }
+
+ public void accept(@NotNull FeatureModelVisitor visitor) {
+ visitor.visitXorBlock(this);
+ }
+
+ @Override
+ public void accept(@NotNull PsiElementVisitor visitor) {
+ if (visitor instanceof FeatureModelVisitor) accept((FeatureModelVisitor)visitor);
+ else super.accept(visitor);
+ }
+
+ @Override
+ @NotNull
+ public FeatureModelSubLogic getSubLogic() {
+ return findNotNullChildByClass(FeatureModelSubLogic.class);
+ }
+
+}
diff --git a/src/main/java/se/isselab/HAnS/featureModel/FeatureModel.bnf b/src/main/java/se/isselab/HAnS/featureModel/FeatureModel.bnf
index f8c3f258..0160783a 100644
--- a/src/main/java/se/isselab/HAnS/featureModel/FeatureModel.bnf
+++ b/src/main/java/se/isselab/HAnS/featureModel/FeatureModel.bnf
@@ -30,10 +30,15 @@ limitations under the License.
psiImplUtilClass="se.isselab.HAnS.featureModel.psi.impl.FeatureModelPsiImplUtil"
}
-featureModelFile ::= (feature (feature)?)?
+featureModelFile ::= (feature (feature)?)?
// &begin[Referencing]
-feature ::= (FEATURENAME (CRLF+ ((INDENT) feature* DEDENT)?)?) {
+COMPONENT ::= feature | LOGIC
+LOGIC ::= (OR_BLOCK) | (XOR_BLOCK)
+XOR_BLOCK ::= XOR (SUB_LOGIC)
+OR_BLOCK ::= OR (SUB_LOGIC)
+SUB_LOGIC ::= INDENT COMPONENT (COMPONENT)+ DEDENT
+feature ::= (FEATURENAME (QUESTIONMARK)? (CRLF+ ((INDENT) (COMPONENT)* DEDENT)?)?) {
mixin="se.isselab.HAnS.referencing.impl.FeatureAnnotationNamedElementImpl"
implements="se.isselab.HAnS.referencing.FeatureAnnotationNamedElement"
methods=[getLPQText getLPQStack renameFeature addFeature deleteFeature getName setName getNameIdentifier getFeatureName getPresentation
diff --git a/src/main/java/se/isselab/HAnS/featureModel/FeatureModel.flex b/src/main/java/se/isselab/HAnS/featureModel/FeatureModel.flex
index 945006a0..8c334f0b 100644
--- a/src/main/java/se/isselab/HAnS/featureModel/FeatureModel.flex
+++ b/src/main/java/se/isselab/HAnS/featureModel/FeatureModel.flex
@@ -35,6 +35,9 @@ import java.util.Deque;
CRLF=[\n|\r\n]
SPACE= [' ']
+QUESTIONMARK = ['?']
+OR = 'OR'
+XOR = ['xor']
INDENT=[\t]
@@ -42,74 +45,262 @@ FEATURENAME= [[A-Z]+|[a-z]+|[0-9]+|'_'+|'\''+]
%{
int current_line_indent = 0;
- int indent_level = 0;
- int indent_caller = indent;
+ int indent_level = 0;
+ int indent_caller = indent;
- final int TAB_WIDTH = 4;
+ final int TAB_WIDTH = 4;
- int test = 1;
+ int test = 1;
- Deque indent_levels = new ArrayDeque();
+ Deque indent_levels = new ArrayDeque();
+ private IElementType goIntoFeaturename() {
+ if(current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(feature);
+ return FeatureModelTypes.INDENT;
+ }
+ else if(current_line_indent < indent_levels.peek()) {
+ indent_levels.pop();
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(feature);
+ }
+ else if(current_line_indent != indent_levels.peek()) {
+ yypushback(1);
+ yybegin(dedent);
+ return FeatureModelTypes.DEDENT;
+ }
+ else {
+ yypushback(1);
+ yybegin(feature);
+ return FeatureModelTypes.DEDENT;
+ }
+ }
+ else if (current_line_indent == 0){
+ yypushback(1);
+ yybegin(feature);
+ }
+ else {
+ yypushback(1);
+ yybegin(feature);
+ return FeatureModelTypes.CRLF;
+ }
+ return null;
+ }
+ private IElementType goToDedent(int nextStae) {
+ indent_levels.pop();
+ if(current_line_indent != indent_levels.peek()) {
+ yypushback(1);
+ return FeatureModelTypes.DEDENT;
+ }
+ else {
+ yypushback(1);
+ yybegin(nextStae);
+ return FeatureModelTypes.DEDENT;
+ }
+ }
+ private void print(String str) {System.out.println(str);}
%}
%x indent
%s feature
%s dedent
+%s questionmark
+%s or1
+%s or2
+%s xor1
+%s xor2
+%s xor3
+%s returFeaturename
+%s returnOr
+%s returnOrDedent
+%s returnXor
+%s returnXorDedent
%%
. { yypushback(1); indent_levels.push(0); yybegin(feature); }
{SPACE} { current_line_indent++; }
+
{INDENT} { current_line_indent = (current_line_indent + TAB_WIDTH) & ~(TAB_WIDTH-1); }
{CRLF}+ { current_line_indent = 0; return FeatureModelTypes.CRLF; }
-. {
- indent_levels.pop();
- if(current_line_indent != indent_levels.peek()) {
- yypushback(1);
- return FeatureModelTypes.DEDENT;
- }
- else {
- yypushback(1);
- yybegin(feature);
- return FeatureModelTypes.DEDENT;
- }
-}
+[^] {
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+ [^] {
+ yypushback(1);
+ yybegin(indent);
+ current_line_indent += 2;
+ return FeatureModelTypes.OR;
+ }
+ [^] {
+ return goToDedent(returnOr);
+ }
+ [^] {
+ yypushback(1);
+ yybegin(indent);
+ current_line_indent += 3;
+ return FeatureModelTypes.XOR;
+ }
+ [^] {
+ return goToDedent(returnXor);
+ }
-{FEATURENAME} {
- if(current_line_indent > indent_levels.peek()) {
- indent_levels.push(current_line_indent);
- yypushback(1);
- yybegin(feature);
- return FeatureModelTypes.INDENT;
- }
- else if(current_line_indent < indent_levels.peek()) {
- indent_levels.pop();
- if (current_line_indent > indent_levels.peek()) {
+{QUESTIONMARK} {
+ yybegin(indent);
+ return FeatureModelTypes.QUESTIONMARK;
+ }
+"o" {
+ yybegin(or1);
+ }
+"r" {
+ yybegin(or2);
+ }
+({CRLF}|{INDENT}) {
+ if (current_line_indent > indent_levels.peek()) {
indent_levels.push(current_line_indent);
yypushback(1);
- yybegin(feature);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
+ }
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+[^] {
+ IElementType result = goIntoFeaturename();
+ if (result != null) return result;
+ }
+
+{FEATURENAME} {
+ IElementType result = goIntoFeaturename();
+ if (result != null) return result;
+ }
+[^] {
+ if(current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returnOr);
+ return FeatureModelTypes.INDENT;
+ }
+ else if(current_line_indent < indent_levels.peek()) {
+ indent_levels.pop();
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returnOr);
+ }
+ else if(current_line_indent != indent_levels.peek()) {
+ yypushback(1);
+ yybegin(returnOrDedent);
+ return FeatureModelTypes.DEDENT;
+ }
+ else {
+ yypushback(1);
+ yybegin(returnOr);
+ return FeatureModelTypes.DEDENT;
+ }
+ }
+ else if (current_line_indent == 0){
+ yypushback(1);
+ yybegin(returnOr);
+ }
+ else {
+ yypushback(1);
+ yybegin(returnOr);
+ return FeatureModelTypes.CRLF;
+ }
+ }
+
+"x" {
+ yybegin(xor1);
+ }
+"o" {
+ yybegin(xor2);
+ }
+({CRLF}|{INDENT}) {
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
+ }
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+[^] {
+ IElementType result = goIntoFeaturename();
+ if (result != null) return result;
+ }
+
+"r" {
+ yybegin(xor3);
+ }
+({CRLF}|{INDENT}) {
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
}
- else if(current_line_indent != indent_levels.peek()) {
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+[^] {
+ IElementType result = goIntoFeaturename();
+ if (result != null) return result;
+ }
+{FEATURENAME} {
+ IElementType result = goIntoFeaturename();
+ if (result != null) return result;
+ }
+[^] {
+ if(current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
yypushback(1);
- yybegin(dedent);
- return FeatureModelTypes.DEDENT;
+ yybegin(returnXor);
+ return FeatureModelTypes.INDENT;
+ }
+ else if(current_line_indent < indent_levels.peek()) {
+ indent_levels.pop();
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yypushback(1);
+ yybegin(returnXor);
+ }
+ else if(current_line_indent != indent_levels.peek()) {
+ yypushback(1);
+ yybegin(returnXorDedent);
+ return FeatureModelTypes.DEDENT;
+ }
+ else {
+ yypushback(1);
+ yybegin(returnXor);
+ return FeatureModelTypes.DEDENT;
+ }
+ }
+ else if (current_line_indent == 0){
+ yypushback(1);
+ yybegin(returnXor);
}
else {
yypushback(1);
- yybegin(feature);
- return FeatureModelTypes.DEDENT;
+ yybegin(returnXor);
+ return FeatureModelTypes.CRLF;
}
- }
- else if (current_line_indent == 0){
- yypushback(1);
- yybegin(feature);
- }
- else {
- yypushback(1);
- yybegin(feature);
- return FeatureModelTypes.CRLF;
- }
+ }
+
+
+. {
+ return goToDedent(feature);
+}
+
+{FEATURENAME} {
+ IElementType result = goIntoFeaturename();
+ if (result != null) return result;
}
<> {
@@ -121,9 +312,35 @@ FEATURENAME= [[A-Z]+|[a-z]+|[0-9]+|'_'+|'\''+]
yybegin(YYINITIAL);
}
}
+<> {
+ yybegin(indent);
+ return FeatureModelTypes.OR;
+ }
+<> {
+ yybegin(indent);
+ return FeatureModelTypes.XOR;
+ }
+
+<> {
+ if (current_line_indent > indent_levels.peek()) {
+ indent_levels.push(current_line_indent);
+ yybegin(returFeaturename);
+ return FeatureModelTypes.INDENT;
+ }
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+<> {
+ yybegin(indent);
+ return FeatureModelTypes.FEATURENAME;
+ }
+
{FEATURENAME}+ {
yybegin(indent);
return FeatureModelTypes.FEATURENAME;
}
-[^] { return TokenType.BAD_CHARACTER; }
+[^] {
+ return TokenType.BAD_CHARACTER;
+ }
+
diff --git a/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelHighlightingLexer.flex b/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelHighlightingLexer.flex
index 0b45fc1c..aa11a121 100644
--- a/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelHighlightingLexer.flex
+++ b/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelHighlightingLexer.flex
@@ -32,6 +32,9 @@ import com.intellij.psi.TokenType;
CRLF=[\n|\r\n]
SPACE= [' ']
+QUESTIONMARK = "?"
+OR = "or"
+XOR = "xor"
INDENT=[\t]
@@ -41,7 +44,13 @@ FEATURENAME= [[A-Z]+|[a-z]+|[0-9]+|'_'+|'\''+]
%%
- {FEATURENAME}+ { yybegin(YYINITIAL); return FeatureModelTypes.FEATURENAME; }
+{QUESTIONMARK} { return FeatureModelTypes.QUESTIONMARK;}
+
+{OR} { return FeatureModelTypes.OR;}
+
+{XOR} { return FeatureModelTypes.XOR;}
+
+ {FEATURENAME}+ {yybegin(YYINITIAL); return FeatureModelTypes.FEATURENAME; }
{CRLF}+ { yybegin(YYINITIAL); return FeatureModelTypes.CRLF; }
diff --git a/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelHighlightingLexerAdapter.java b/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelHighlightingLexerAdapter.java
index cd560478..a31b8c49 100644
--- a/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelHighlightingLexerAdapter.java
+++ b/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelHighlightingLexerAdapter.java
@@ -17,6 +17,7 @@
import com.intellij.lexer.FlexAdapter;
import se.isselab.HAnS.featureModel.FeatureModelHighlightingLexer;
+import se.isselab.HAnS.featureModel.FeatureModelLexer;
public class FeatureModelHighlightingLexerAdapter extends FlexAdapter {
public FeatureModelHighlightingLexerAdapter() {
diff --git a/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelSyntaxHighlighter.java b/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelSyntaxHighlighter.java
index 4e194234..b2ab5b9f 100644
--- a/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelSyntaxHighlighter.java
+++ b/src/main/java/se/isselab/HAnS/syntaxHighlighting/featureModel/FeatureModelSyntaxHighlighter.java
@@ -35,10 +35,19 @@ public class FeatureModelSyntaxHighlighter extends SyntaxHighlighterBase {
createTextAttributesKey("FEATURENAME", DefaultLanguageHighlighterColors.CONSTANT);
public static final TextAttributesKey BAD_CHARACTER =
createTextAttributesKey("HAnS_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER);
+ public static final TextAttributesKey QUESTIONMARK =
+ createTextAttributesKey("LOGICKEY", DefaultLanguageHighlighterColors.KEYWORD);
+ public static final TextAttributesKey OR =
+ createTextAttributesKey("OR", DefaultLanguageHighlighterColors.DOC_COMMENT_TAG);
+ public static final TextAttributesKey XOR =
+ createTextAttributesKey("XOR", DefaultLanguageHighlighterColors.NUMBER);
private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER};
private static final TextAttributesKey[] FEATURE_KEYS = new TextAttributesKey[]{FEATURE};
+ private static final TextAttributesKey[] QUESTIONMARK_KEYS = new TextAttributesKey[]{QUESTIONMARK};
+ private static final TextAttributesKey[] OR_KEYS = new TextAttributesKey[]{OR};
+ private static final TextAttributesKey[] XOR_KEYS = new TextAttributesKey[]{XOR};
private static final TextAttributesKey[] EMPTY_KEYS = new TextAttributesKey[0];
@Override
@@ -50,7 +59,13 @@ public class FeatureModelSyntaxHighlighter extends SyntaxHighlighterBase {
public TextAttributesKey @NotNull [] getTokenHighlights(IElementType tokenType) {
if (tokenType.equals(FeatureModelTypes.FEATURENAME)){
return FEATURE_KEYS;
- } else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
+ } else if (tokenType.equals(FeatureModelTypes.QUESTIONMARK)) {
+ return QUESTIONMARK_KEYS;
+ } else if (tokenType.equals(FeatureModelTypes.OR)) {
+ return OR_KEYS;
+ } else if (tokenType.equals(FeatureModelTypes.XOR)) {
+ return XOR_KEYS;
+ }else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
return BAD_CHAR_KEYS;
} else {
return EMPTY_KEYS;