Skip to content
Merged
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
568 changes: 300 additions & 268 deletions org/w3c/css/parser/analyzer/CssParser.java

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions org/w3c/css/parser/analyzer/CssParser.jj
Original file line number Diff line number Diff line change
Expand Up @@ -3725,11 +3725,9 @@ CssValue function() :
} else if (funcname.equals("light-dark(")) {
color.setLightDark(ac, exp);
return color;
/*
} else if (funcname.equals("color-mix(")) {
color.setColorMix(ac, exp);
return color;
*/
} else if (funcname.equals("image(")) {
CssImage img = new CssImage();
img.setImageList(exp, ac);
Expand Down
138 changes: 93 additions & 45 deletions org/w3c/css/parser/analyzer/CssParserTokenManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
import java.util.ArrayList;

/** Token Manager. */
@SuppressWarnings("unused")public class CssParserTokenManager implements CssParserConstants {
public class CssParserTokenManager implements CssParserConstants {

/** Debug output. */
public java.io.PrintStream debugStream = System.out;
Expand Down Expand Up @@ -7936,7 +7936,7 @@ else if ((0x10000000100L & l) != 0L)
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
{ jjCheckNAddTwoStates(951, 952); }
break;
default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break;
default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break;
}
} while(i != startsAt);
}
Expand Down Expand Up @@ -7972,6 +7972,44 @@ else if (jjmatchedPos == strPos && jjmatchedKind > strKind)

return toRet;
}

/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, "\57\52", "\74\41\55\55",
"\55\55\76", null, "\174\75", null, null, "\55", null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, "\175", "\136\75", "\44\75",
"\52\75", "\75", "\73", "\57", "\133", "\135", "\52", "\56", "\51", "\50", "\72", null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, "\72\72", null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, "\41", "\44", "\45", "\46", "\140", "\77", "\74", "\174", "\74\75", };
protected Token jjFillToken()
{
final Token t;
final String curTokenImage;
final int beginLine;
final int endLine;
final int beginColumn;
final int endColumn;
String im = jjstrLiteralImages[jjmatchedKind];
curTokenImage = (im == null) ? input_stream.GetImage() : im;
beginLine = input_stream.getBeginLine();
beginColumn = input_stream.getBeginColumn();
endLine = input_stream.getEndLine();
endColumn = input_stream.getEndColumn();
t = Token.newToken(jjmatchedKind, curTokenImage);

t.beginLine = beginLine;
t.endLine = endLine;
t.beginColumn = beginColumn;
t.endColumn = endColumn;

return t;
}
static final int[] jjnextStates = {
989, 990, 991, 670, 673, 675, 992, 993, 994, 677, 680, 682, 995, 996, 997, 684,
687, 690, 998, 999, 1000, 692, 695, 697, 1001, 1002, 1003, 699, 702, 704, 1004, 1005,
Expand Down Expand Up @@ -8133,44 +8171,6 @@ private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, lo
}
}

/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, "\57\52", "\74\41\55\55",
"\55\55\76", null, "\174\75", null, null, "\55", null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, "\175", "\136\75", "\44\75",
"\52\75", "\75", "\73", "\57", "\133", "\135", "\52", "\56", "\51", "\50", "\72", null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, "\72\72", null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, "\41", "\44", "\45", "\46", "\140", "\77", "\74", "\174", "\74\75", };
protected Token jjFillToken()
{
final Token t;
final String curTokenImage;
final int beginLine;
final int endLine;
final int beginColumn;
final int endColumn;
String im = jjstrLiteralImages[jjmatchedKind];
curTokenImage = (im == null) ? input_stream.GetImage() : im;
beginLine = input_stream.getBeginLine();
beginColumn = input_stream.getBeginColumn();
endLine = input_stream.getEndLine();
endColumn = input_stream.getEndColumn();
t = Token.newToken(jjmatchedKind, curTokenImage);

t.beginLine = beginLine;
t.endLine = endLine;
t.beginColumn = beginColumn;
t.endColumn = endColumn;

return t;
}

int curLexState = 0;
int defaultLexState = 0;
int jjnewStateCnt;
Expand All @@ -8192,7 +8192,7 @@ public Token getNextToken()
{
curChar = input_stream.BeginToken();
}
catch(java.io.IOException e)
catch(Exception e)
{
jjmatchedKind = 0;
jjmatchedPos = -1;
Expand Down Expand Up @@ -8253,6 +8253,31 @@ public Token getNextToken()
}
}

void SkipLexicalActions(Token matchedToken)
{
switch(jjmatchedKind)
{
default :
break;
}
}
void MoreLexicalActions()
{
jjimageLen += (lengthOfMatch = jjmatchedPos + 1);
switch(jjmatchedKind)
{
default :
break;
}
}
void TokenLexicalActions(Token matchedToken)
{
switch(jjmatchedKind)
{
default :
break;
}
}
private void jjCheckNAdd(int state)
{
if (jjrounds[state] != jjround)
Expand Down Expand Up @@ -8296,9 +8321,14 @@ public CssParserTokenManager (SimpleCharStream stream, int lexState){
}

/** Reinitialise parser. */

public void ReInit(SimpleCharStream stream)
{
jjmatchedPos = jjnewStateCnt = 0;


jjmatchedPos =
jjnewStateCnt =
0;
curLexState = defaultLexState;
input_stream = stream;
ReInitRounds();
Expand All @@ -8314,6 +8344,7 @@ private void ReInitRounds()

/** Reinitialise parser. */
public void ReInit(SimpleCharStream stream, int lexState)

{
ReInit(stream);
SwitchTo(lexState);
Expand All @@ -8328,10 +8359,22 @@ public void SwitchTo(int lexState)
curLexState = lexState;
}


/** Lexer state names. */
public static final String[] lexStateNames = {
"DEFAULT",
};

/** Lex State array. */
public static final int[] jjnewLexState = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1,
};
static final long[] jjtoToken = {
0xffffffffffe00001L, 0xff803fffffffffffL, 0x7ffffffL,
};
Expand All @@ -8340,12 +8383,17 @@ public void SwitchTo(int lexState)
};
static final long[] jjtoSpecial = {
0x2L, 0x0L, 0x0L,
};
static final long[] jjtoMore = {
0x0L, 0x0L, 0x0L,
};
protected SimpleCharStream input_stream;

private final int[] jjrounds = new int[1082];
private final int[] jjstateSet = new int[2 * 1082];


protected char curChar;
private final StringBuilder jjimage = new StringBuilder();
private StringBuilder image = jjimage;
private int jjimageLen;
private int lengthOfMatch;
protected int curChar;
}
38 changes: 22 additions & 16 deletions org/w3c/css/parser/analyzer/ParseException.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 6.0 */
/* JavaCCOptions:KEEP_LINE_COL=null */
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */
/* JavaCCOptions:KEEP_LINE_COLUMN=true */
package org.w3c.css.parser.analyzer;

/**
Expand All @@ -20,6 +20,11 @@ public class ParseException extends Exception {
*/
private static final long serialVersionUID = 1L;

/**
* The end of line string for this machine.
*/
protected static String EOL = System.getProperty("line.separator", "\n");

/**
* This constructor is used by the method "generateParseException"
* in the generated parser. Calling this constructor generates
Expand Down Expand Up @@ -88,7 +93,7 @@ public ParseException(String message) {
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");

StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
Expand All @@ -101,7 +106,7 @@ private static String initialise(Token currentToken,
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
expected.append("...");
}
expected.append(eol).append(" ");
expected.append(EOL).append(" ");
}
String retval = "Encountered \"";
Token tok = currentToken.next;
Expand All @@ -118,20 +123,23 @@ private static String initialise(Token currentToken,
tok = tok.next;
}
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
retval += "." + eol;
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + eol + " ";
retval += "." + EOL;


if (expectedTokenSequences.length == 0) {
// Nothing to add here
} else {
retval += "Was expecting one of:" + eol + " ";
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + EOL + " ";
} else {
retval += "Was expecting one of:" + EOL + " ";
}
retval += expected.toString();
}
retval += expected.toString();

return retval;
}

/**
* The end of line string for this machine.
*/
protected String eol = System.getProperty("line.separator", "\n");

/**
* Used to convert raw characters to their escaped version
Expand All @@ -144,8 +152,6 @@ static String add_escapes(String str) {
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
{
case 0 :
continue;
case '\b':
retval.append("\\b");
continue;
Expand Down Expand Up @@ -184,4 +190,4 @@ static String add_escapes(String str) {
}

}
/* JavaCC - OriginalChecksum=6b814b86a7f83d7302418ed01d10c383 (do not edit this line) */
/* JavaCC - OriginalChecksum=7d68a6a068da3c9ac8d23a9a0983a253 (do not edit this line) */
12 changes: 6 additions & 6 deletions org/w3c/css/parser/analyzer/SimpleCharStream.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 6.0 */
/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 7.0 */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package org.w3c.css.parser.analyzer;

Expand Down Expand Up @@ -30,13 +30,14 @@ public class SimpleCharStream
protected char[] buffer;
protected int maxNextCharInd = 0;
protected int inBuf = 0;
protected int tabSize = 8;
protected boolean trackLineColumn = false;
protected int tabSize = 1;
protected boolean trackLineColumn = true;

public void setTabSize(int i) { tabSize = i; }
public int getTabSize() { return tabSize; }



protected void ExpandBuff(boolean wrapAround)
{
char[] newbuffer = new char[bufsize + 2048];
Expand Down Expand Up @@ -467,8 +468,7 @@ public void adjustBeginLineColumn(int newLine, int newCol)
line = bufline[j];
column = bufcolumn[j];
}

boolean getTrackLineColumn() { return trackLineColumn; }
void setTrackLineColumn(boolean trackLineColumn) { this.trackLineColumn = trackLineColumn; }
void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; }
}
/* JavaCC - OriginalChecksum=e2781e1a6e95beb7efed54cdfe328ade (do not edit this line) */
/* JavaCC - OriginalChecksum=ddaf552144d8059b9d34162bcfbf9de7 (do not edit this line) */
7 changes: 4 additions & 3 deletions org/w3c/css/parser/analyzer/Token.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Generated By:JavaCC: Do not edit this line. Token.java Version 6.0 */
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package org.w3c.css.parser.analyzer;

/**
Expand Down Expand Up @@ -97,6 +97,7 @@ public Token(int kind, String image)
/**
* Returns the image.
*/
@Override
public String toString()
{
return image;
Expand Down Expand Up @@ -128,4 +129,4 @@ public static Token newToken(int ofKind)
}

}
/* JavaCC - OriginalChecksum=7af9a5dffce9b3c54b5b20fb3ae238c7 (do not edit this line) */
/* JavaCC - OriginalChecksum=36fc9b16b8ca0d6418e40ba2b00d4428 (do not edit this line) */
Loading