Skip to content

Commit 110d084

Browse files
committed
Merge branch 'master' of github.com:w3c/css-validator
2 parents 8207dcd + cdbb79a commit 110d084

File tree

8 files changed

+886
-705
lines changed

8 files changed

+886
-705
lines changed

org/w3c/css/parser/analyzer/CssParser.java

Lines changed: 830 additions & 663 deletions
Large diffs are not rendered by default.

org/w3c/css/parser/analyzer/CssParser.jj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,12 +1060,12 @@ void mediaquery(AtRuleMedia mediaRule) :
10601060
String mediarestrictor = null;
10611061
}
10621062
{
1063-
( ( ( ( n=<NOT> | n=<ONLY> ) {
1063+
( LOOKAHEAD(3) ( ( ( n=<NOT> | n=<ONLY> ) {
10641064
mediarestrictor = convertIdent(n.image);
10651065
} ( <S> )+ )?
10661066
n=<IDENT> { mediaRule.addMedia(mediarestrictor, convertIdent(n.image), ac); } ( <S> )*
1067-
( <AND> ( <S> )+ mediaexpression(mediaRule, false) )* ) |
1068-
(mediaexpression(mediaRule, true) ( <AND> ( <S> )+ mediaexpression(mediaRule, false) )* ) ) {
1067+
( <AND> ( <S> )+ ( <NOT> ( <S> )+ )* mediaexpression(mediaRule, true) ( LOOKAHEAD(2) <AND> ( <S> )+ mediaexpression(mediaRule, false) )* )* ) |
1068+
( ( <NOT> ( <S> )+ )* mediaexpression(mediaRule, true) ( <AND> ( <S> )+ mediaexpression(mediaRule, false) )* ) ) {
10691069

10701070
}
10711071
}

org/w3c/css/parser/analyzer/CssParserTokenManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6859,7 +6859,7 @@ else if ((0x1000000010000L & l) != 0L)
68596859
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
68606860
{ jjCheckNAddTwoStates(784, 785); }
68616861
break;
6862-
default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break;
6862+
default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break;
68636863
}
68646864
} while(i != startsAt);
68656865
}
@@ -7088,7 +7088,7 @@ public Token getNextToken()
70887088
{
70897089
curChar = input_stream.BeginToken();
70907090
}
7091-
catch(java.io.IOException e)
7091+
catch(Exception e)
70927092
{
70937093
jjmatchedKind = 0;
70947094
jjmatchedPos = -1;
@@ -7194,6 +7194,7 @@ public CssParserTokenManager (SimpleCharStream stream, int lexState){
71947194
/** Reinitialise parser. */
71957195
public void ReInit(SimpleCharStream stream)
71967196
{
7197+
71977198
jjmatchedPos = jjnewStateCnt = 0;
71987199
curLexState = defaultLexState;
71997200
input_stream = stream;
@@ -7209,9 +7210,10 @@ private void ReInitRounds()
72097210
}
72107211

72117212
/** Reinitialise parser. */
7212-
public void ReInit(SimpleCharStream stream, int lexState)
7213+
public void ReInit( SimpleCharStream stream, int lexState)
72137214
{
7214-
ReInit(stream);
7215+
7216+
ReInit( stream);
72157217
SwitchTo(lexState);
72167218
}
72177219

@@ -7243,5 +7245,5 @@ public void SwitchTo(int lexState)
72437245
private final int[] jjstateSet = new int[2 * 871];
72447246

72457247

7246-
protected char curChar;
7248+
protected int curChar;
72477249
}

org/w3c/css/parser/analyzer/ParseException.java

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 6.0 */
2-
/* JavaCCOptions:KEEP_LINE_COL=null */
2+
/* JavaCCOptions:KEEP_LINE_COLUMN=true */
33
package org.w3c.css.parser.analyzer;
44

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

23+
/**
24+
* The end of line string for this machine.
25+
*/
26+
protected static String EOL = System.getProperty("line.separator", "\n");
27+
2328
/**
2429
* This constructor is used by the method "generateParseException"
2530
* in the generated parser. Calling this constructor generates
@@ -88,7 +93,7 @@ public ParseException(String message) {
8893
private static String initialise(Token currentToken,
8994
int[][] expectedTokenSequences,
9095
String[] tokenImage) {
91-
String eol = System.getProperty("line.separator", "\n");
96+
9297
StringBuffer expected = new StringBuffer();
9398
int maxSize = 0;
9499
for (int i = 0; i < expectedTokenSequences.length; i++) {
@@ -101,7 +106,7 @@ private static String initialise(Token currentToken,
101106
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
102107
expected.append("...");
103108
}
104-
expected.append(eol).append(" ");
109+
expected.append(EOL).append(" ");
105110
}
106111
String retval = "Encountered \"";
107112
Token tok = currentToken.next;
@@ -118,20 +123,23 @@ private static String initialise(Token currentToken,
118123
tok = tok.next;
119124
}
120125
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
121-
retval += "." + eol;
122-
if (expectedTokenSequences.length == 1) {
123-
retval += "Was expecting:" + eol + " ";
126+
retval += "." + EOL;
127+
128+
129+
if (expectedTokenSequences.length == 0) {
130+
// Nothing to add here
124131
} else {
125-
retval += "Was expecting one of:" + eol + " ";
132+
if (expectedTokenSequences.length == 1) {
133+
retval += "Was expecting:" + EOL + " ";
134+
} else {
135+
retval += "Was expecting one of:" + EOL + " ";
136+
}
137+
retval += expected.toString();
126138
}
127-
retval += expected.toString();
139+
128140
return retval;
129141
}
130142

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

136144
/**
137145
* Used to convert raw characters to their escaped version
@@ -144,8 +152,6 @@ static String add_escapes(String str) {
144152
for (int i = 0; i < str.length(); i++) {
145153
switch (str.charAt(i))
146154
{
147-
case 0 :
148-
continue;
149155
case '\b':
150156
retval.append("\\b");
151157
continue;
@@ -184,4 +190,4 @@ static String add_escapes(String str) {
184190
}
185191

186192
}
187-
/* JavaCC - OriginalChecksum=6b814b86a7f83d7302418ed01d10c383 (do not edit this line) */
193+
/* JavaCC - OriginalChecksum=fb55a6089519635c1f3e7e4db2dd6a1a (do not edit this line) */

org/w3c/css/parser/analyzer/SimpleCharStream.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ public class SimpleCharStream
3030
protected char[] buffer;
3131
protected int maxNextCharInd = 0;
3232
protected int inBuf = 0;
33-
protected int tabSize = 8;
34-
protected boolean trackLineColumn = false;
33+
protected int tabSize = 1;
34+
protected boolean trackLineColumn = true;
3535

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

3939

40+
4041
protected void ExpandBuff(boolean wrapAround)
4142
{
4243
char[] newbuffer = new char[bufsize + 2048];
@@ -467,8 +468,7 @@ public void adjustBeginLineColumn(int newLine, int newCol)
467468
line = bufline[j];
468469
column = bufcolumn[j];
469470
}
470-
471471
boolean getTrackLineColumn() { return trackLineColumn; }
472-
void setTrackLineColumn(boolean trackLineColumn) { this.trackLineColumn = trackLineColumn; }
472+
void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; }
473473
}
474-
/* JavaCC - OriginalChecksum=e2781e1a6e95beb7efed54cdfe328ade (do not edit this line) */
474+
/* JavaCC - OriginalChecksum=7645bde3d8623ce07de66fbc5459f098 (do not edit this line) */

org/w3c/css/parser/analyzer/Token.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Generated By:JavaCC: Do not edit this line. Token.java Version 6.0 */
2-
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
2+
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
33
package org.w3c.css.parser.analyzer;
44

55
/**
@@ -128,4 +128,4 @@ public static Token newToken(int ofKind)
128128
}
129129

130130
}
131-
/* JavaCC - OriginalChecksum=7af9a5dffce9b3c54b5b20fb3ae238c7 (do not edit this line) */
131+
/* JavaCC - OriginalChecksum=6acb371821627501ca9e73cd501baefa (do not edit this line) */

org/w3c/css/parser/analyzer/TokenMgrError.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ public class TokenMgrError extends Error
2020
/**
2121
* Lexical error occurred.
2222
*/
23-
static final int LEXICAL_ERROR = 0;
23+
public static final int LEXICAL_ERROR = 0;
2424

2525
/**
2626
* An attempt was made to create a second instance of a static token manager.
2727
*/
28-
static final int STATIC_LEXER_ERROR = 1;
28+
public static final int STATIC_LEXER_ERROR = 1;
2929

3030
/**
3131
* Tried to change to an invalid lexical state.
3232
*/
33-
static final int INVALID_LEXICAL_STATE = 2;
33+
public static final int INVALID_LEXICAL_STATE = 2;
3434

3535
/**
3636
* Detected (and bailed out of) an infinite loop in the token manager.
3737
*/
38-
static final int LOOP_DETECTED = 3;
38+
public static final int LOOP_DETECTED = 3;
3939

4040
/**
4141
* Indicates the reason why the exception is thrown. It will have
@@ -53,8 +53,6 @@ protected static final String addEscapes(String str) {
5353
for (int i = 0; i < str.length(); i++) {
5454
switch (str.charAt(i))
5555
{
56-
case 0 :
57-
continue;
5856
case '\b':
5957
retval.append("\\b");
6058
continue;
@@ -104,11 +102,12 @@ protected static final String addEscapes(String str) {
104102
* curchar : the offending character
105103
* Note: You can customize the lexical error message by modifying this method.
106104
*/
107-
protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
105+
protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) {
106+
char curChar1 = (char)curChar;
108107
return("Lexical error at line " +
109108
errorLine + ", column " +
110109
errorColumn + ". Encountered: " +
111-
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
110+
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + (int)curChar + "), ") +
112111
"after : \"" + addEscapes(errorAfter) + "\"");
113112
}
114113

@@ -140,8 +139,8 @@ public TokenMgrError(String message, int reason) {
140139
}
141140

142141
/** Full Constructor. */
143-
public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
144-
this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
142+
public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) {
143+
this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
145144
}
146145
}
147-
/* JavaCC - OriginalChecksum=a0e8995d1ac9564645c0d60018a41934 (do not edit this line) */
146+
/* JavaCC - OriginalChecksum=8aa730919ae2540f8651db5bc248e427 (do not edit this line) */

org/w3c/css/properties/css3/CssWordBreak.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818
public class CssWordBreak extends org.w3c.css.properties.css.CssWordBreak {
1919

2020
public static final CssIdent[] allowed_values;
21+
public static final CssIdent break_word;
2122

2223
static {
23-
String[] _allowed_values = {"normal", "keep-all", "break-all"};
24+
String[] _allowed_values = {"normal", "keep-all", "break-all",
25+
"break-word"};
2426
allowed_values = new CssIdent[_allowed_values.length];
2527
int i = 0;
2628
for (String s : _allowed_values) {
2729
allowed_values[i++] = CssIdent.getIdent(s);
2830
}
31+
break_word = CssIdent.getIdent("break-word");
2932
}
3033

3134
public static final CssIdent getAllowedValue(CssIdent ident) {
@@ -75,6 +78,10 @@ public CssWordBreak(ApplContext ac, CssExpression expression, boolean check)
7578
val.toString(),
7679
getPropertyName(), ac);
7780
}
81+
// break-word is deprecated
82+
if (value == break_word) {
83+
ac.getFrame().addWarning("deprecated", value.toString());
84+
}
7885
}
7986
} else {
8087
throw new InvalidParamException("value",

0 commit comments

Comments
 (0)