Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
* <a href="http://www.jflex.de/">JFlex</a> 1.7.0
* from the specification file <tt>FeatureModelHighlightingLexer.flex</tt>
*/
public class FeatureModelHighlightingLexer implements FlexLexer {

/** This character denotes the end of file */
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -103,33 +153,38 @@ 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++);
}
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();
Expand All @@ -156,15 +211,16 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) {
};

/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
* 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;
Expand Down Expand Up @@ -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
Expand All @@ -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() {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand All @@ -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;

Expand All @@ -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);
}
Expand Down
Loading