Causes a multitude of compile errors on the build server.
This reverts commit d2874fde4b
.
Change-Id: I49787b347944b614b9e98778b3219b7045cf2bfe
tags/7.2.0.beta1
@@ -71,13 +71,3 @@ WebContent/VAADIN/vaadinPush.debug.js | |||
# build result folders | |||
*/result | |||
result | |||
# /theme-compiler | |||
/theme-compiler/result | |||
/theme-compiler/src/com/vaadin/sass/internal/parser/CharStream.java | |||
/theme-compiler/src/com/vaadin/sass/internal/parser/ParserImpl.java | |||
/theme-compiler/src/com/vaadin/sass/internal/parser/ParserImplConstants.java | |||
/theme-compiler/src/com/vaadin/sass/internal/parser/ParserImplTokenManager.java | |||
/theme-compiler/src/com/vaadin/sass/internal/parser/Token.java | |||
/theme-compiler/src/com/vaadin/sass/internal/parser/TokenMgrError.java | |||
/theme-compiler/src/com/vaadin/sass/internal/parser/ParseException.java |
@@ -36,6 +36,7 @@ | |||
<path location="${gwt.dev.super.src}" /> | |||
<path location="${gwt.dev.src}" /> | |||
<path refid="client-compiler.deps" /> | |||
<path refid="theme-compiler.deps" /> | |||
<path refid="server.deps" /> | |||
<path refid="shared.deps" /> | |||
<path refid="uitest.deps" /> | |||
@@ -67,14 +68,9 @@ | |||
</antcall> | |||
</target> | |||
<target name="compile-theme" depends="generate-theme-compiler"> | |||
<path id="theme.classpath"> | |||
<path refid="classpath"/> | |||
<path refid="theme-compiler.deps" /> | |||
</path> | |||
<target name="compile-theme"> | |||
<java classname="com.vaadin.buildhelpers.CompileTheme" failonerror="yes" fork="yes"> | |||
<classpath refid="theme.classpath" /> | |||
<classpath refid="classpath" /> | |||
<jvmarg value="-Djava.awt.headless=true" /> | |||
<arg value="--theme" /> | |||
<arg value="${theme}" /> | |||
@@ -146,7 +142,4 @@ | |||
</fileset> | |||
</copy> | |||
</target> | |||
<target name="generate-theme-compiler"> | |||
<ant antfile="${basedir}/theme-compiler/build.xml" target="parser" dir="${basedir}/theme-compiler" /> | |||
</target> | |||
</project> |
@@ -23,7 +23,7 @@ | |||
<!--<property name="classes.exclude" value="com/vaadin/buildhelpers/**" | |||
/> --> | |||
<target name="parser" depends="-check-parser" unless="parser.exists"> | |||
<target name="parser"> | |||
<!-- Copy javacc-5.0.jar to ${result.dir}/javacc/javacc.jar as the | |||
javacc task requires the jar to be named javacc.jar --> | |||
<property name="javacc.home" location="${result.dir}/javacc" /> | |||
@@ -32,29 +32,15 @@ | |||
<mkdir dir="${generate.dir}" /> | |||
<!-- Generate new parser files in another directory, this ensure | |||
they are always generated --> | |||
<copy todir="${generate.dir}"> | |||
<fileset dir="${parser.src.dir}"> | |||
<exclude name="**/*.java"/> | |||
</fileset> | |||
</copy> | |||
<javacc target="${generate.dir}/ParserImpl.jj" javacchome="${javacc.home}" errorreporting="true"/> | |||
<copy file="${parser.src.dir}/Parser.jj" todir="${generate.dir}" /> | |||
<javacc target="${generate.dir}/Parser.jj" javacchome="${javacc.home}"> | |||
</javacc> | |||
<!-- Add headers to the generated files and copy back to src --> | |||
<antcontrib:foreach target="prepend.generated.file.header" param="path"> | |||
<path> | |||
<fileset dir="${generate.dir}" includes="*.java" excludes="ParseException.java" /> | |||
</path> | |||
</antcontrib:foreach> | |||
<copy todir="${parser.src.dir}"> | |||
<fileset dir="${generate.dir}"> | |||
<include name="*.jj"/> | |||
<exclude name="ParserImpl.jj"/> | |||
</fileset> | |||
<globmapper from="*.jj" to="*.java"/> | |||
</copy> | |||
</target> | |||
<target name="-check-parser"> | |||
<available file="${parser.src.dir}/ParserImpl.java" property="parser.exists"/> | |||
</target> | |||
<target name="prepend.generated.file.header"> |
@@ -171,7 +171,7 @@ public class ScssStylesheet extends Node { | |||
source.setEncoding(parentStylesheet.getCharset()); | |||
} | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
parser.setErrorHandler(errorHandler); | |||
parser.setDocumentHandler(documentHandler); | |||
@@ -0,0 +1,130 @@ | |||
/* | |||
* Copyright 2000-2013 Vaadin Ltd. | |||
* | |||
* 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 | |||
* | |||
* http://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. | |||
*/ | |||
/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 5.0 */ | |||
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ | |||
package com.vaadin.sass.internal.parser; | |||
/** | |||
* This interface describes a character stream that maintains line and | |||
* column number positions of the characters. It also has the capability | |||
* to backup the stream to some extent. An implementation of this | |||
* interface is used in the TokenManager implementation generated by | |||
* JavaCCParser. | |||
* | |||
* All the methods except backup can be implemented in any fashion. backup | |||
* needs to be implemented correctly for the correct operation of the lexer. | |||
* Rest of the methods are all used to get information like line number, | |||
* column number and the String that constitutes a token and are not used | |||
* by the lexer. Hence their implementation won't affect the generated lexer's | |||
* operation. | |||
*/ | |||
public | |||
interface CharStream { | |||
/** | |||
* Returns the next character from the selected input. The method | |||
* of selecting the input is the responsibility of the class | |||
* implementing this interface. Can throw any java.io.IOException. | |||
*/ | |||
char readChar() throws java.io.IOException; | |||
@Deprecated | |||
/** | |||
* Returns the column position of the character last read. | |||
* @deprecated | |||
* @see #getEndColumn | |||
*/ | |||
int getColumn(); | |||
@Deprecated | |||
/** | |||
* Returns the line number of the character last read. | |||
* @deprecated | |||
* @see #getEndLine | |||
*/ | |||
int getLine(); | |||
/** | |||
* Returns the column number of the last character for current token (being | |||
* matched after the last call to BeginTOken). | |||
*/ | |||
int getEndColumn(); | |||
/** | |||
* Returns the line number of the last character for current token (being | |||
* matched after the last call to BeginTOken). | |||
*/ | |||
int getEndLine(); | |||
/** | |||
* Returns the column number of the first character for current token (being | |||
* matched after the last call to BeginTOken). | |||
*/ | |||
int getBeginColumn(); | |||
/** | |||
* Returns the line number of the first character for current token (being | |||
* matched after the last call to BeginTOken). | |||
*/ | |||
int getBeginLine(); | |||
/** | |||
* Backs up the input stream by amount steps. Lexer calls this method if it | |||
* had already read some characters, but could not use them to match a | |||
* (longer) token. So, they will be used again as the prefix of the next | |||
* token and it is the implemetation's responsibility to do this right. | |||
*/ | |||
void backup(int amount); | |||
/** | |||
* Returns the next character that marks the beginning of the next token. | |||
* All characters must remain in the buffer between two successive calls | |||
* to this method to implement backup correctly. | |||
*/ | |||
char BeginToken() throws java.io.IOException; | |||
/** | |||
* Returns a string made up of characters from the marked token beginning | |||
* to the current buffer position. Implementations have the choice of returning | |||
* anything that they want to. For example, for efficiency, one might decide | |||
* to just return null, which is a valid implementation. | |||
*/ | |||
String GetImage(); | |||
/** | |||
* Returns an array of characters that make up the suffix of length 'len' for | |||
* the currently matched token. This is used to build up the matched string | |||
* for use in actions in the case of MORE. A simple and inefficient | |||
* implementation of this is as follows : | |||
* | |||
* { | |||
* String t = GetImage(); | |||
* return t.substring(t.length() - len, t.length()).toCharArray(); | |||
* } | |||
*/ | |||
char[] GetSuffix(int len); | |||
/** | |||
* The lexer calls this function to indicate that it is done with the stream | |||
* and hence implementations can free any resources held by this class. | |||
* Again, the body of this function can be just empty and it will not | |||
* affect the lexer's operation. | |||
*/ | |||
void Done(); | |||
} | |||
/* JavaCC - OriginalChecksum=deb80d024b50bdc8bfaadaf528157233 (do not edit this line) */ |
@@ -51,34 +51,82 @@ public class LocatorImpl implements Locator { | |||
int line; | |||
int column; | |||
@Override | |||
public String getURI() { | |||
return uri; | |||
} | |||
@Override | |||
public int getLineNumber() { | |||
return line; | |||
} | |||
@Override | |||
public int getColumnNumber() { | |||
return column; | |||
} | |||
/** | |||
* Creates a LocatorImpl | |||
* Creates a new LocatorImpl | |||
*/ | |||
public LocatorImpl(Parser p) { | |||
if (W3CDebug) { | |||
System.err.println("LocatorImpl::newLocator(" + p + ");"); | |||
} | |||
uri = p.source.getURI(); | |||
line = p.token.beginLine; | |||
column = p.token.beginColumn; | |||
} | |||
/** | |||
* Reinitializes a LocatorImpl | |||
*/ | |||
public LocatorImpl(Parser p, Token tok) { | |||
if (W3CDebug) { | |||
System.err.println("LocatorImpl::newLocator(" + p + ", " + tok | |||
+ ");"); | |||
} | |||
uri = p.source.getURI(); | |||
line = tok.beginLine; | |||
column = tok.beginColumn; | |||
} | |||
/** | |||
* Reinitializes a LocatorImpl | |||
*/ | |||
public LocatorImpl(Parser p, int line, int column) { | |||
if (W3CDebug) { | |||
System.err.println("LocatorImpl::newLocator(" + p + ", " + line | |||
+ ", " + column + ");"); | |||
} | |||
uri = p.getInputSource().getURI(); | |||
uri = p.source.getURI(); | |||
this.line = line; | |||
this.column = column; | |||
} | |||
/** | |||
* Reinitializes a LocatorImpl | |||
*/ | |||
public LocatorImpl reInit(Parser p) { | |||
if (W3CDebug) { | |||
System.err.println("LocatorImpl::reInit(" + p + ");"); | |||
} | |||
uri = p.source.getURI(); | |||
line = p.token.beginLine; | |||
column = p.token.beginColumn; | |||
return this; | |||
} | |||
/** | |||
* Reinitializes a LocatorImpl | |||
*/ | |||
public LocatorImpl reInit(Parser p, Token tok) { | |||
if (W3CDebug) { | |||
System.err.println("LocatorImpl::reInit(" + p + ", " + tok + ");"); | |||
} | |||
uri = p.source.getURI(); | |||
line = tok.beginLine; | |||
column = tok.beginColumn; | |||
return this; | |||
} | |||
/** | |||
* Reinitializes a LocatorImpl | |||
*/ | |||
@@ -87,7 +135,7 @@ public class LocatorImpl implements Locator { | |||
System.err.println("LocatorImpl::reInit(" + p + ", " + line + ", " | |||
+ column + ");"); | |||
} | |||
uri = p.getInputSource().getURI(); | |||
uri = p.source.getURI(); | |||
this.line = line; | |||
this.column = column; | |||
return this; |
@@ -19,17 +19,185 @@ package com.vaadin.sass.internal.parser; | |||
import org.w3c.css.sac.CSSException; | |||
/** | |||
* Do not modify this file. It will be regenerated by the build procedure. Edit | |||
* ParseException.jj file instead. The reason of this file presence here: avoid | |||
* compilation errors if build procedure hasn't been yet executed. | |||
* This exception is thrown when parse errors are encountered. You can | |||
* explicitly create objects of this exception type by calling the method | |||
* generateParseException in the generated parser. | |||
* | |||
* You can modify this class to customize your error reporting mechanisms so | |||
* long as you retain the public fields. | |||
*/ | |||
public class ParseException extends CSSException { | |||
private static final long serialVersionUID = -8556588037264585977L; | |||
/** | |||
* This constructor is used by the method "generateParseException" in the | |||
* generated parser. Calling this constructor generates a new object of this | |||
* type with the fields "currentToken", "expectedTokenSequences", and | |||
* "tokenImage" set. The boolean flag "specialConstructor" is also set to | |||
* true to indicate that this constructor was used to create this object. | |||
* This constructor calls its super class with the empty string to force the | |||
* "toString" method of parent class "Throwable" to print the error message | |||
* in the form: ParseException: <result of getMessage> | |||
*/ | |||
public ParseException(Token currentTokenVal, | |||
int[][] expectedTokenSequencesVal, String[] tokenImageVal) { | |||
super(""); | |||
specialConstructor = true; | |||
currentToken = currentTokenVal; | |||
expectedTokenSequences = expectedTokenSequencesVal; | |||
tokenImage = tokenImageVal; | |||
} | |||
/** | |||
* The following constructors are for use by you for whatever purpose you | |||
* can think of. Constructing the exception in this manner makes the | |||
* exception behave in the normal way - i.e., as documented in the class | |||
* "Throwable". The fields "errorToken", "expectedTokenSequences", and | |||
* "tokenImage" do not contain relevant information. The JavaCC generated | |||
* code does not use these constructors. | |||
*/ | |||
public ParseException() { | |||
super(); | |||
specialConstructor = false; | |||
} | |||
public ParseException(String message) { | |||
super(message); | |||
specialConstructor = false; | |||
} | |||
/** | |||
* This variable determines which constructor was used to create this object | |||
* and thereby affects the semantics of the "getMessage" method (see below). | |||
*/ | |||
protected boolean specialConstructor; | |||
/** | |||
* This is the last token that has been consumed successfully. If this | |||
* object has been created due to a parse error, the token followng this | |||
* token will (therefore) be the first error token. | |||
*/ | |||
public Token currentToken; | |||
/** | |||
* Each entry in this array is an array of integers. Each array of integers | |||
* represents a sequence of tokens (by their ordinal values) that is | |||
* expected at this point of the parse. | |||
*/ | |||
public int[][] expectedTokenSequences; | |||
/** | |||
* This is a reference to the "tokenImage" array of the generated parser | |||
* within which the parse error occurred. This array is defined in the | |||
* generated ...Constants interface. | |||
*/ | |||
public String[] tokenImage; | |||
/** | |||
* This method has the standard behavior when this object has been created | |||
* using the standard constructors. Otherwise, it uses "currentToken" and | |||
* "expectedTokenSequences" to generate a parse error message and returns | |||
* it. If this object has been created due to a parse error, and you do not | |||
* catch it (it gets thrown from the parser), then this method is called | |||
* during the printing of the final stack trace, and hence the correct error | |||
* message gets displayed. | |||
*/ | |||
@Override | |||
public String getMessage() { | |||
if (!specialConstructor) { | |||
return super.getMessage(); | |||
} | |||
String expected = ""; | |||
int maxSize = 0; | |||
for (int i = 0; i < expectedTokenSequences.length; i++) { | |||
if (maxSize < expectedTokenSequences[i].length) { | |||
maxSize = expectedTokenSequences[i].length; | |||
} | |||
for (int j = 0; j < expectedTokenSequences[i].length; j++) { | |||
expected += tokenImage[expectedTokenSequences[i][j]] + " "; | |||
} | |||
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { | |||
expected += "..."; | |||
} | |||
expected += eol + " "; | |||
} | |||
String retval = "Encountered \""; | |||
Token tok = currentToken.next; | |||
for (int i = 0; i < maxSize; i++) { | |||
if (i != 0) { | |||
retval += " "; | |||
} | |||
if (tok.kind == 0) { | |||
retval += tokenImage[0]; | |||
break; | |||
} | |||
retval += add_escapes(tok.image); | |||
tok = tok.next; | |||
} | |||
retval += "\" at line " + currentToken.next.beginLine + ", column " | |||
+ currentToken.next.beginColumn + "." + eol; | |||
if (expectedTokenSequences.length == 1) { | |||
retval += "Was expecting:" + eol + " "; | |||
} else { | |||
retval += "Was expecting one of:" + eol + " "; | |||
} | |||
retval += expected; | |||
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 when these raw | |||
* version cannot be used as part of an ASCII string literal. | |||
*/ | |||
protected String add_escapes(String str) { | |||
StringBuffer retval = new StringBuffer(); | |||
char ch; | |||
for (int i = 0; i < str.length(); i++) { | |||
switch (str.charAt(i)) { | |||
case 0: | |||
continue; | |||
case '\b': | |||
retval.append("\\b"); | |||
continue; | |||
case '\t': | |||
retval.append("\\t"); | |||
continue; | |||
case '\n': | |||
retval.append("\\n"); | |||
continue; | |||
case '\f': | |||
retval.append("\\f"); | |||
continue; | |||
case '\r': | |||
retval.append("\\r"); | |||
continue; | |||
case '\"': | |||
retval.append("\\\""); | |||
continue; | |||
case '\'': | |||
retval.append("\\\'"); | |||
continue; | |||
case '\\': | |||
retval.append("\\\\"); | |||
continue; | |||
default: | |||
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { | |||
String s = "0000" + Integer.toString(ch, 16); | |||
retval.append("\\u" | |||
+ s.substring(s.length() - 4, s.length())); | |||
} else { | |||
retval.append(ch); | |||
} | |||
continue; | |||
} | |||
} | |||
return retval.toString(); | |||
} | |||
} |
@@ -1,203 +0,0 @@ | |||
/* | |||
* Copyright 2000-2013 Vaadin Ltd. | |||
* | |||
* 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 | |||
* | |||
* http://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. | |||
*/ | |||
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */ | |||
package com.vaadin.sass.internal.parser; | |||
import org.w3c.css.sac.CSSException; | |||
/** | |||
* This exception is thrown when parse errors are encountered. You can | |||
* explicitly create objects of this exception type by calling the method | |||
* generateParseException in the generated parser. | |||
* | |||
* You can modify this class to customize your error reporting mechanisms so | |||
* long as you retain the public fields. | |||
*/ | |||
public class ParseException extends CSSException { | |||
private static final long serialVersionUID = -8556588037264585977L; | |||
/** | |||
* This constructor is used by the method "generateParseException" in the | |||
* generated parser. Calling this constructor generates a new object of this | |||
* type with the fields "currentToken", "expectedTokenSequences", and | |||
* "tokenImage" set. The boolean flag "specialConstructor" is also set to | |||
* true to indicate that this constructor was used to create this object. | |||
* This constructor calls its super class with the empty string to force the | |||
* "toString" method of parent class "Throwable" to print the error message | |||
* in the form: ParseException: <result of getMessage> | |||
*/ | |||
public ParseException(Token currentTokenVal, | |||
int[][] expectedTokenSequencesVal, String[] tokenImageVal) { | |||
super(""); | |||
specialConstructor = true; | |||
currentToken = currentTokenVal; | |||
expectedTokenSequences = expectedTokenSequencesVal; | |||
tokenImage = tokenImageVal; | |||
} | |||
/** | |||
* The following constructors are for use by you for whatever purpose you | |||
* can think of. Constructing the exception in this manner makes the | |||
* exception behave in the normal way - i.e., as documented in the class | |||
* "Throwable". The fields "errorToken", "expectedTokenSequences", and | |||
* "tokenImage" do not contain relevant information. The JavaCC generated | |||
* code does not use these constructors. | |||
*/ | |||
public ParseException() { | |||
super(); | |||
specialConstructor = false; | |||
} | |||
public ParseException(String message) { | |||
super(message); | |||
specialConstructor = false; | |||
} | |||
/** | |||
* This variable determines which constructor was used to create this object | |||
* and thereby affects the semantics of the "getMessage" method (see below). | |||
*/ | |||
protected boolean specialConstructor; | |||
/** | |||
* This is the last token that has been consumed successfully. If this | |||
* object has been created due to a parse error, the token followng this | |||
* token will (therefore) be the first error token. | |||
*/ | |||
public Token currentToken; | |||
/** | |||
* Each entry in this array is an array of integers. Each array of integers | |||
* represents a sequence of tokens (by their ordinal values) that is | |||
* expected at this point of the parse. | |||
*/ | |||
public int[][] expectedTokenSequences; | |||
/** | |||
* This is a reference to the "tokenImage" array of the generated parser | |||
* within which the parse error occurred. This array is defined in the | |||
* generated ...Constants interface. | |||
*/ | |||
public String[] tokenImage; | |||
/** | |||
* This method has the standard behavior when this object has been created | |||
* using the standard constructors. Otherwise, it uses "currentToken" and | |||
* "expectedTokenSequences" to generate a parse error message and returns | |||
* it. If this object has been created due to a parse error, and you do not | |||
* catch it (it gets thrown from the parser), then this method is called | |||
* during the printing of the final stack trace, and hence the correct error | |||
* message gets displayed. | |||
*/ | |||
@Override | |||
public String getMessage() { | |||
if (!specialConstructor) { | |||
return super.getMessage(); | |||
} | |||
String expected = ""; | |||
int maxSize = 0; | |||
for (int i = 0; i < expectedTokenSequences.length; i++) { | |||
if (maxSize < expectedTokenSequences[i].length) { | |||
maxSize = expectedTokenSequences[i].length; | |||
} | |||
for (int j = 0; j < expectedTokenSequences[i].length; j++) { | |||
expected += tokenImage[expectedTokenSequences[i][j]] + " "; | |||
} | |||
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { | |||
expected += "..."; | |||
} | |||
expected += eol + " "; | |||
} | |||
String retval = "Encountered \""; | |||
Token tok = currentToken.next; | |||
for (int i = 0; i < maxSize; i++) { | |||
if (i != 0) { | |||
retval += " "; | |||
} | |||
if (tok.kind == 0) { | |||
retval += tokenImage[0]; | |||
break; | |||
} | |||
retval += add_escapes(tok.image); | |||
tok = tok.next; | |||
} | |||
retval += "\" at line " + currentToken.next.beginLine + ", column " | |||
+ currentToken.next.beginColumn + "." + eol; | |||
if (expectedTokenSequences.length == 1) { | |||
retval += "Was expecting:" + eol + " "; | |||
} else { | |||
retval += "Was expecting one of:" + eol + " "; | |||
} | |||
retval += expected; | |||
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 when these raw | |||
* version cannot be used as part of an ASCII string literal. | |||
*/ | |||
protected String add_escapes(String str) { | |||
StringBuffer retval = new StringBuffer(); | |||
char ch; | |||
for (int i = 0; i < str.length(); i++) { | |||
switch (str.charAt(i)) { | |||
case 0: | |||
continue; | |||
case '\b': | |||
retval.append("\\b"); | |||
continue; | |||
case '\t': | |||
retval.append("\\t"); | |||
continue; | |||
case '\n': | |||
retval.append("\\n"); | |||
continue; | |||
case '\f': | |||
retval.append("\\f"); | |||
continue; | |||
case '\r': | |||
retval.append("\\r"); | |||
continue; | |||
case '\"': | |||
retval.append("\\\""); | |||
continue; | |||
case '\'': | |||
retval.append("\\\'"); | |||
continue; | |||
case '\\': | |||
retval.append("\\\\"); | |||
continue; | |||
default: | |||
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { | |||
String s = "0000" + Integer.toString(ch, 16); | |||
retval.append("\\u" | |||
+ s.substring(s.length() - 4, s.length())); | |||
} else { | |||
retval.append(ch); | |||
} | |||
continue; | |||
} | |||
} | |||
return retval.toString(); | |||
} | |||
} |
@@ -30,7 +30,7 @@ options { | |||
DEBUG_PARSER = true; */ | |||
} | |||
PARSER_BEGIN(ParserImpl) | |||
PARSER_BEGIN(Parser) | |||
package com.vaadin.sass.internal.parser; | |||
@@ -70,7 +70,7 @@ import com.vaadin.sass.internal.tree.*; | |||
* @author Philippe Le H�garet | |||
* @version $Revision: 1.15 $ | |||
*/ | |||
public class ParserImpl implements org.w3c.css.sac.Parser, Parser { | |||
public class Parser implements org.w3c.css.sac.Parser { | |||
// replaces all \t, \n, etc with this StringBuffer. | |||
static final StringBuilder SPACE = new StringBuilder(" "); | |||
@@ -91,7 +91,7 @@ public class ParserImpl implements org.w3c.css.sac.Parser, Parser { | |||
/** | |||
* Creates a new Parser | |||
*/ | |||
public ParserImpl() { | |||
public Parser() { | |||
this((CharStream) null); | |||
} | |||
@@ -397,17 +397,17 @@ public class ParserImpl implements org.w3c.css.sac.Parser, Parser { | |||
private LocatorImpl currentLocator; | |||
private Locator getLocator() { | |||
if (currentLocator == null) { | |||
currentLocator = new LocatorImpl(this, token.beginLine, token.beginColumn); | |||
currentLocator = new LocatorImpl(this); | |||
return currentLocator; | |||
} | |||
return currentLocator.reInit(this, token.beginLine, token.beginColumn); | |||
return currentLocator.reInit(this); | |||
} | |||
private LocatorImpl getLocator(Token save) { | |||
if (currentLocator == null) { | |||
currentLocator = new LocatorImpl(this, save.beginLine, save.beginColumn); | |||
currentLocator = new LocatorImpl(this, save); | |||
return currentLocator; | |||
} | |||
return currentLocator.reInit(this, save.beginLine, save.beginColumn); | |||
return currentLocator.reInit(this, save); | |||
} | |||
private void reportError(Locator l, Exception e) { | |||
@@ -455,7 +455,7 @@ public class ParserImpl implements org.w3c.css.sac.Parser, Parser { | |||
} | |||
} | |||
PARSER_END(ParserImpl) | |||
PARSER_END(Parser) | |||
/* | |||
* The tokenizer | |||
@@ -465,7 +465,7 @@ PARSER_END(ParserImpl) | |||
TOKEN : | |||
{ | |||
< S : ( [ " ", "\t" , "\n" , "\r", "\f" ] )+ > | |||
{ image = ParserImpl.SPACE; } | |||
{ image = Parser.SPACE; } | |||
} | |||
/* |
@@ -0,0 +1,392 @@ | |||
/* | |||
* Copyright 2000-2013 Vaadin Ltd. | |||
* | |||
* 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 | |||
* | |||
* http://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. | |||
*/ | |||
/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ | |||
package com.vaadin.sass.internal.parser; | |||
/** | |||
* Token literal values and constants. | |||
* Generated by org.javacc.parser.OtherFilesGen#start() | |||
*/ | |||
public interface ParserConstants { | |||
/** End of File. */ | |||
int EOF = 0; | |||
/** RegularExpression Id. */ | |||
int S = 1; | |||
/** RegularExpression Id. */ | |||
int SINGLE_LINE_COMMENT = 2; | |||
/** RegularExpression Id. */ | |||
int FORMAL_COMMENT = 5; | |||
/** RegularExpression Id. */ | |||
int MULTI_LINE_COMMENT = 6; | |||
/** RegularExpression Id. */ | |||
int CDO = 8; | |||
/** RegularExpression Id. */ | |||
int CDC = 9; | |||
/** RegularExpression Id. */ | |||
int LBRACE = 10; | |||
/** RegularExpression Id. */ | |||
int RBRACE = 11; | |||
/** RegularExpression Id. */ | |||
int DASHMATCH = 12; | |||
/** RegularExpression Id. */ | |||
int CARETMATCH = 13; | |||
/** RegularExpression Id. */ | |||
int DOLLARMATCH = 14; | |||
/** RegularExpression Id. */ | |||
int STARMATCH = 15; | |||
/** RegularExpression Id. */ | |||
int INCLUDES = 16; | |||
/** RegularExpression Id. */ | |||
int EQ = 17; | |||
/** RegularExpression Id. */ | |||
int PLUS = 18; | |||
/** RegularExpression Id. */ | |||
int MINUS = 19; | |||
/** RegularExpression Id. */ | |||
int COMMA = 20; | |||
/** RegularExpression Id. */ | |||
int SEMICOLON = 21; | |||
/** RegularExpression Id. */ | |||
int PRECEDES = 22; | |||
/** RegularExpression Id. */ | |||
int SIBLING = 23; | |||
/** RegularExpression Id. */ | |||
int SUCCEEDS = 24; | |||
/** RegularExpression Id. */ | |||
int DIV = 25; | |||
/** RegularExpression Id. */ | |||
int LBRACKET = 26; | |||
/** RegularExpression Id. */ | |||
int RBRACKET = 27; | |||
/** RegularExpression Id. */ | |||
int ANY = 28; | |||
/** RegularExpression Id. */ | |||
int MOD = 29; | |||
/** RegularExpression Id. */ | |||
int PARENT = 30; | |||
/** RegularExpression Id. */ | |||
int DOT = 31; | |||
/** RegularExpression Id. */ | |||
int LPARAN = 32; | |||
/** RegularExpression Id. */ | |||
int RPARAN = 33; | |||
/** RegularExpression Id. */ | |||
int COMPARE = 34; | |||
/** RegularExpression Id. */ | |||
int OR = 35; | |||
/** RegularExpression Id. */ | |||
int AND = 36; | |||
/** RegularExpression Id. */ | |||
int NOT_EQ = 37; | |||
/** RegularExpression Id. */ | |||
int COLON = 38; | |||
/** RegularExpression Id. */ | |||
int INTERPOLATION = 39; | |||
/** RegularExpression Id. */ | |||
int NONASCII = 40; | |||
/** RegularExpression Id. */ | |||
int H = 41; | |||
/** RegularExpression Id. */ | |||
int UNICODE = 42; | |||
/** RegularExpression Id. */ | |||
int ESCAPE = 43; | |||
/** RegularExpression Id. */ | |||
int NMSTART = 44; | |||
/** RegularExpression Id. */ | |||
int NMCHAR = 45; | |||
/** RegularExpression Id. */ | |||
int STRINGCHAR = 46; | |||
/** RegularExpression Id. */ | |||
int D = 47; | |||
/** RegularExpression Id. */ | |||
int NAME = 48; | |||
/** RegularExpression Id. */ | |||
int TO = 49; | |||
/** RegularExpression Id. */ | |||
int THROUGH = 50; | |||
/** RegularExpression Id. */ | |||
int EACH_IN = 51; | |||
/** RegularExpression Id. */ | |||
int FROM = 52; | |||
/** RegularExpression Id. */ | |||
int MIXIN_SYM = 53; | |||
/** RegularExpression Id. */ | |||
int INCLUDE_SYM = 54; | |||
/** RegularExpression Id. */ | |||
int FUNCTION_SYM = 55; | |||
/** RegularExpression Id. */ | |||
int RETURN_SYM = 56; | |||
/** RegularExpression Id. */ | |||
int DEBUG_SYM = 57; | |||
/** RegularExpression Id. */ | |||
int WARN_SYM = 58; | |||
/** RegularExpression Id. */ | |||
int FOR_SYM = 59; | |||
/** RegularExpression Id. */ | |||
int EACH_SYM = 60; | |||
/** RegularExpression Id. */ | |||
int WHILE_SYM = 61; | |||
/** RegularExpression Id. */ | |||
int IF_SYM = 62; | |||
/** RegularExpression Id. */ | |||
int ELSE_SYM = 63; | |||
/** RegularExpression Id. */ | |||
int EXTEND_SYM = 64; | |||
/** RegularExpression Id. */ | |||
int MOZ_DOCUMENT_SYM = 65; | |||
/** RegularExpression Id. */ | |||
int SUPPORTS_SYM = 66; | |||
/** RegularExpression Id. */ | |||
int CONTENT_SYM = 67; | |||
/** RegularExpression Id. */ | |||
int MICROSOFT_RULE = 68; | |||
/** RegularExpression Id. */ | |||
int IF = 69; | |||
/** RegularExpression Id. */ | |||
int GUARDED_SYM = 70; | |||
/** RegularExpression Id. */ | |||
int STRING = 71; | |||
/** RegularExpression Id. */ | |||
int IDENT = 72; | |||
/** RegularExpression Id. */ | |||
int NUMBER = 73; | |||
/** RegularExpression Id. */ | |||
int _URL = 74; | |||
/** RegularExpression Id. */ | |||
int URL = 75; | |||
/** RegularExpression Id. */ | |||
int VARIABLE = 76; | |||
/** RegularExpression Id. */ | |||
int PERCENTAGE = 77; | |||
/** RegularExpression Id. */ | |||
int PT = 78; | |||
/** RegularExpression Id. */ | |||
int MM = 79; | |||
/** RegularExpression Id. */ | |||
int CM = 80; | |||
/** RegularExpression Id. */ | |||
int PC = 81; | |||
/** RegularExpression Id. */ | |||
int IN = 82; | |||
/** RegularExpression Id. */ | |||
int PX = 83; | |||
/** RegularExpression Id. */ | |||
int EMS = 84; | |||
/** RegularExpression Id. */ | |||
int LEM = 85; | |||
/** RegularExpression Id. */ | |||
int REM = 86; | |||
/** RegularExpression Id. */ | |||
int EXS = 87; | |||
/** RegularExpression Id. */ | |||
int DEG = 88; | |||
/** RegularExpression Id. */ | |||
int RAD = 89; | |||
/** RegularExpression Id. */ | |||
int GRAD = 90; | |||
/** RegularExpression Id. */ | |||
int MS = 91; | |||
/** RegularExpression Id. */ | |||
int SECOND = 92; | |||
/** RegularExpression Id. */ | |||
int HZ = 93; | |||
/** RegularExpression Id. */ | |||
int KHZ = 94; | |||
/** RegularExpression Id. */ | |||
int DIMEN = 95; | |||
/** RegularExpression Id. */ | |||
int HASH = 96; | |||
/** RegularExpression Id. */ | |||
int IMPORT_SYM = 97; | |||
/** RegularExpression Id. */ | |||
int MEDIA_SYM = 98; | |||
/** RegularExpression Id. */ | |||
int CHARSET_SYM = 99; | |||
/** RegularExpression Id. */ | |||
int PAGE_SYM = 100; | |||
/** RegularExpression Id. */ | |||
int FONT_FACE_SYM = 101; | |||
/** RegularExpression Id. */ | |||
int KEY_FRAME_SYM = 102; | |||
/** RegularExpression Id. */ | |||
int ATKEYWORD = 103; | |||
/** RegularExpression Id. */ | |||
int IMPORTANT_SYM = 104; | |||
/** RegularExpression Id. */ | |||
int RANGE0 = 105; | |||
/** RegularExpression Id. */ | |||
int RANGE1 = 106; | |||
/** RegularExpression Id. */ | |||
int RANGE2 = 107; | |||
/** RegularExpression Id. */ | |||
int RANGE3 = 108; | |||
/** RegularExpression Id. */ | |||
int RANGE4 = 109; | |||
/** RegularExpression Id. */ | |||
int RANGE5 = 110; | |||
/** RegularExpression Id. */ | |||
int RANGE6 = 111; | |||
/** RegularExpression Id. */ | |||
int RANGE = 112; | |||
/** RegularExpression Id. */ | |||
int UNI = 113; | |||
/** RegularExpression Id. */ | |||
int UNICODERANGE = 114; | |||
/** RegularExpression Id. */ | |||
int REMOVE = 115; | |||
/** RegularExpression Id. */ | |||
int APPEND = 116; | |||
/** RegularExpression Id. */ | |||
int CONTAINS = 117; | |||
/** RegularExpression Id. */ | |||
int FUNCTION = 118; | |||
/** RegularExpression Id. */ | |||
int UNKNOWN = 119; | |||
/** Lexical state. */ | |||
int DEFAULT = 0; | |||
/** Lexical state. */ | |||
int IN_FORMAL_COMMENT = 1; | |||
/** Lexical state. */ | |||
int IN_MULTI_LINE_COMMENT = 2; | |||
/** Literal token values. */ | |||
String[] tokenImage = { | |||
"<EOF>", | |||
"<S>", | |||
"<SINGLE_LINE_COMMENT>", | |||
"<token of kind 3>", | |||
"\"/*\"", | |||
"\"*/\"", | |||
"\"*/\"", | |||
"<token of kind 7>", | |||
"\"<!--\"", | |||
"\"-->\"", | |||
"\"{\"", | |||
"\"}\"", | |||
"\"|=\"", | |||
"\"^=\"", | |||
"\"$=\"", | |||
"\"*=\"", | |||
"\"~=\"", | |||
"\"=\"", | |||
"\"+\"", | |||
"\"-\"", | |||
"\",\"", | |||
"\";\"", | |||
"\">\"", | |||
"\"~\"", | |||
"\"<\"", | |||
"\"/\"", | |||
"\"[\"", | |||
"\"]\"", | |||
"\"*\"", | |||
"\"%\"", | |||
"\"&\"", | |||
"\".\"", | |||
"\"(\"", | |||
"\")\"", | |||
"\"==\"", | |||
"\"||\"", | |||
"\"&&\"", | |||
"\"!=\"", | |||
"\":\"", | |||
"<INTERPOLATION>", | |||
"<NONASCII>", | |||
"<H>", | |||
"<UNICODE>", | |||
"<ESCAPE>", | |||
"<NMSTART>", | |||
"<NMCHAR>", | |||
"<STRINGCHAR>", | |||
"<D>", | |||
"<NAME>", | |||
"\"to\"", | |||
"\"through\"", | |||
"\"in\"", | |||
"\"from\"", | |||
"\"@mixin\"", | |||
"\"@include\"", | |||
"\"@function\"", | |||
"\"@return\"", | |||
"\"@debug\"", | |||
"\"@warn\"", | |||
"\"@for\"", | |||
"\"@each\"", | |||
"\"@while\"", | |||
"\"@if\"", | |||
"\"@else\"", | |||
"\"@extend\"", | |||
"\"@-moz-document\"", | |||
"\"@supports\"", | |||
"\"@content\"", | |||
"<MICROSOFT_RULE>", | |||
"\"if\"", | |||
"<GUARDED_SYM>", | |||
"<STRING>", | |||
"<IDENT>", | |||
"<NUMBER>", | |||
"<_URL>", | |||
"<URL>", | |||
"<VARIABLE>", | |||
"<PERCENTAGE>", | |||
"<PT>", | |||
"<MM>", | |||
"<CM>", | |||
"<PC>", | |||
"<IN>", | |||
"<PX>", | |||
"<EMS>", | |||
"<LEM>", | |||
"<REM>", | |||
"<EXS>", | |||
"<DEG>", | |||
"<RAD>", | |||
"<GRAD>", | |||
"<MS>", | |||
"<SECOND>", | |||
"<HZ>", | |||
"<KHZ>", | |||
"<DIMEN>", | |||
"<HASH>", | |||
"\"@import\"", | |||
"\"@media\"", | |||
"\"@charset\"", | |||
"\"@page\"", | |||
"\"@font-face\"", | |||
"<KEY_FRAME_SYM>", | |||
"<ATKEYWORD>", | |||
"<IMPORTANT_SYM>", | |||
"<RANGE0>", | |||
"<RANGE1>", | |||
"<RANGE2>", | |||
"<RANGE3>", | |||
"<RANGE4>", | |||
"<RANGE5>", | |||
"<RANGE6>", | |||
"<RANGE>", | |||
"<UNI>", | |||
"<UNICODERANGE>", | |||
"<REMOVE>", | |||
"<APPEND>", | |||
"<CONTAINS>", | |||
"<FUNCTION>", | |||
"<UNKNOWN>", | |||
}; | |||
} |
@@ -0,0 +1,146 @@ | |||
/* | |||
* Copyright 2000-2013 Vaadin Ltd. | |||
* | |||
* 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 | |||
* | |||
* http://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. | |||
*/ | |||
/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ | |||
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ | |||
package com.vaadin.sass.internal.parser; | |||
/** | |||
* Describes the input token stream. | |||
*/ | |||
public class Token implements java.io.Serializable { | |||
/** | |||
* The version identifier for this Serializable class. | |||
* Increment only if the <i>serialized</i> form of the | |||
* class changes. | |||
*/ | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* An integer that describes the kind of this token. This numbering | |||
* system is determined by JavaCCParser, and a table of these numbers is | |||
* stored in the file ...Constants.java. | |||
*/ | |||
public int kind; | |||
/** The line number of the first character of this Token. */ | |||
public int beginLine; | |||
/** The column number of the first character of this Token. */ | |||
public int beginColumn; | |||
/** The line number of the last character of this Token. */ | |||
public int endLine; | |||
/** The column number of the last character of this Token. */ | |||
public int endColumn; | |||
/** | |||
* The string image of the token. | |||
*/ | |||
public String image; | |||
/** | |||
* A reference to the next regular (non-special) token from the input | |||
* stream. If this is the last token from the input stream, or if the | |||
* token manager has not read tokens beyond this one, this field is | |||
* set to null. This is true only if this token is also a regular | |||
* token. Otherwise, see below for a description of the contents of | |||
* this field. | |||
*/ | |||
public Token next; | |||
/** | |||
* This field is used to access special tokens that occur prior to this | |||
* token, but after the immediately preceding regular (non-special) token. | |||
* If there are no such special tokens, this field is set to null. | |||
* When there are more than one such special token, this field refers | |||
* to the last of these special tokens, which in turn refers to the next | |||
* previous special token through its specialToken field, and so on | |||
* until the first special token (whose specialToken field is null). | |||
* The next fields of special tokens refer to other special tokens that | |||
* immediately follow it (without an intervening regular token). If there | |||
* is no such token, this field is null. | |||
*/ | |||
public Token specialToken; | |||
/** | |||
* An optional attribute value of the Token. | |||
* Tokens which are not used as syntactic sugar will often contain | |||
* meaningful values that will be used later on by the compiler or | |||
* interpreter. This attribute value is often different from the image. | |||
* Any subclass of Token that actually wants to return a non-null value can | |||
* override this method as appropriate. | |||
*/ | |||
public Object getValue() { | |||
return null; | |||
} | |||
/** | |||
* No-argument constructor | |||
*/ | |||
public Token() {} | |||
/** | |||
* Constructs a new token for the specified Image. | |||
*/ | |||
public Token(int kind) | |||
{ | |||
this(kind, null); | |||
} | |||
/** | |||
* Constructs a new token for the specified Image and Kind. | |||
*/ | |||
public Token(int kind, String image) | |||
{ | |||
this.kind = kind; | |||
this.image = image; | |||
} | |||
/** | |||
* Returns the image. | |||
*/ | |||
public String toString() | |||
{ | |||
return image; | |||
} | |||
/** | |||
* Returns a new Token object, by default. However, if you want, you | |||
* can create and return subclass objects based on the value of ofKind. | |||
* Simply add the cases to the switch for all those special cases. | |||
* For example, if you have a subclass of Token called IDToken that | |||
* you want to create if ofKind is ID, simply add something like : | |||
* | |||
* case MyParserConstants.ID : return new IDToken(ofKind, image); | |||
* | |||
* to the following switch statement. Then you can cast matchedToken | |||
* variable to the appropriate type and use sit in your lexical actions. | |||
*/ | |||
public static Token newToken(int ofKind, String image) | |||
{ | |||
switch(ofKind) | |||
{ | |||
default : return new Token(ofKind, image); | |||
} | |||
} | |||
public static Token newToken(int ofKind) | |||
{ | |||
return newToken(ofKind, null); | |||
} | |||
} | |||
/* JavaCC - OriginalChecksum=dad2146dc89e68f66e77382c9e448fb7 (do not edit this line) */ |
@@ -0,0 +1,162 @@ | |||
/* | |||
* Copyright 2000-2013 Vaadin Ltd. | |||
* | |||
* 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 | |||
* | |||
* http://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. | |||
*/ | |||
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ | |||
/* JavaCCOptions: */ | |||
package com.vaadin.sass.internal.parser; | |||
/** Token Manager Error. */ | |||
public class TokenMgrError extends Error | |||
{ | |||
/** | |||
* The version identifier for this Serializable class. | |||
* Increment only if the <i>serialized</i> form of the | |||
* class changes. | |||
*/ | |||
private static final long serialVersionUID = 1L; | |||
/* | |||
* Ordinals for various reasons why an Error of this type can be thrown. | |||
*/ | |||
/** | |||
* Lexical error occurred. | |||
*/ | |||
static final int LEXICAL_ERROR = 0; | |||
/** | |||
* An attempt was made to create a second instance of a static token manager. | |||
*/ | |||
static final int STATIC_LEXER_ERROR = 1; | |||
/** | |||
* Tried to change to an invalid lexical state. | |||
*/ | |||
static final int INVALID_LEXICAL_STATE = 2; | |||
/** | |||
* Detected (and bailed out of) an infinite loop in the token manager. | |||
*/ | |||
static final int LOOP_DETECTED = 3; | |||
/** | |||
* Indicates the reason why the exception is thrown. It will have | |||
* one of the above 4 values. | |||
*/ | |||
int errorCode; | |||
/** | |||
* Replaces unprintable characters by their escaped (or unicode escaped) | |||
* equivalents in the given string | |||
*/ | |||
protected static final String addEscapes(String str) { | |||
StringBuffer retval = new StringBuffer(); | |||
char ch; | |||
for (int i = 0; i < str.length(); i++) { | |||
switch (str.charAt(i)) | |||
{ | |||
case 0 : | |||
continue; | |||
case '\b': | |||
retval.append("\\b"); | |||
continue; | |||
case '\t': | |||
retval.append("\\t"); | |||
continue; | |||
case '\n': | |||
retval.append("\\n"); | |||
continue; | |||
case '\f': | |||
retval.append("\\f"); | |||
continue; | |||
case '\r': | |||
retval.append("\\r"); | |||
continue; | |||
case '\"': | |||
retval.append("\\\""); | |||
continue; | |||
case '\'': | |||
retval.append("\\\'"); | |||
continue; | |||
case '\\': | |||
retval.append("\\\\"); | |||
continue; | |||
default: | |||
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { | |||
String s = "0000" + Integer.toString(ch, 16); | |||
retval.append("\\u" + s.substring(s.length() - 4, s.length())); | |||
} else { | |||
retval.append(ch); | |||
} | |||
continue; | |||
} | |||
} | |||
return retval.toString(); | |||
} | |||
/** | |||
* Returns a detailed message for the Error when it is thrown by the | |||
* token manager to indicate a lexical error. | |||
* Parameters : | |||
* EOFSeen : indicates if EOF caused the lexical error | |||
* curLexState : lexical state in which this error occurred | |||
* errorLine : line number when the error occurred | |||
* errorColumn : column number when the error occurred | |||
* errorAfter : prefix that was seen before this error occurred | |||
* curchar : the offending character | |||
* Note: You can customize the lexical error message by modifying this method. | |||
*/ | |||
protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { | |||
return("Lexical error at line " + | |||
errorLine + ", column " + | |||
errorColumn + ". Encountered: " + | |||
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + | |||
"after : \"" + addEscapes(errorAfter) + "\""); | |||
} | |||
/** | |||
* You can also modify the body of this method to customize your error messages. | |||
* For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not | |||
* of end-users concern, so you can return something like : | |||
* | |||
* "Internal Error : Please file a bug report .... " | |||
* | |||
* from this method for such cases in the release version of your parser. | |||
*/ | |||
public String getMessage() { | |||
return super.getMessage(); | |||
} | |||
/* | |||
* Constructors of various flavors follow. | |||
*/ | |||
/** No arg constructor. */ | |||
public TokenMgrError() { | |||
} | |||
/** Constructor with message and reason. */ | |||
public TokenMgrError(String message, int reason) { | |||
super(message); | |||
errorCode = reason; | |||
} | |||
/** Full Constructor. */ | |||
public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { | |||
this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); | |||
} | |||
} | |||
/* JavaCC - OriginalChecksum=c7c96e9cf4a9320d03dd722437439354 (do not edit this line) */ |
@@ -34,7 +34,7 @@ public class ParserTest { | |||
@Test | |||
public void testParsePropertyValue() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
LexicalUnit value = parser.parsePropertyValue(new InputSource( | |||
new StringReader("$margin/2;"))); | |||
@@ -53,7 +53,7 @@ public class ParserTest { | |||
@Test | |||
public void testCanIngoreSingleLineComment() { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
try { |
@@ -36,7 +36,7 @@ public class Interpolation extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, URISyntaxException, | |||
IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -38,7 +38,7 @@ public class Comments extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, URISyntaxException, | |||
IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -42,7 +42,7 @@ public class CompassImports extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scssOtherDirectory) |
@@ -43,7 +43,7 @@ public class ControlDirectives extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -37,7 +37,7 @@ public class Extends extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, URISyntaxException, | |||
IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -36,7 +36,7 @@ public class Functions extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -37,7 +37,7 @@ public class Imports extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -42,7 +42,7 @@ public class Mixins extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, URISyntaxException, | |||
IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -38,7 +38,7 @@ public class NestedProperties extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -37,7 +37,7 @@ public class Nesting extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -37,7 +37,7 @@ public class ParentImports extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -35,7 +35,7 @@ public class ParentSelector extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -19,7 +19,7 @@ public class VariableGuarded extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |
@@ -40,7 +40,7 @@ public class Variables extends AbstractTestBase { | |||
@Test | |||
public void testParser() throws CSSException, IOException { | |||
Parser parser = Parser.ParserAccessor.getParser(); | |||
Parser parser = new Parser(); | |||
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); | |||
parser.setDocumentHandler(handler); | |||
parser.parseStyleSheet(getClass().getResource(scss).getPath()); |