/** * Creates a parse exception. */ protected CSSParseException createCSSParseException(String key) { return createCSSParseException(key, null); }
/** * Creates a parse exception. */ protected CSSParseException createCSSParseException(String key) { return createCSSParseException(key, null); }
/** * Creates a parse exception. */ protected CSSParseException createCSSParseException(String key) { return createCSSParseException(key, null); }
/** * Reports a parsing error. */ protected void reportError(String key, Object[] params) { reportError(createCSSParseException(key, params)); }
/** * Reports a parsing error. */ protected void reportError(String key, Object[] params) { reportError(createCSSParseException(key, params)); }
/** * Reports a parsing error. */ protected void reportError(String key, Object[] params) { reportError(createCSSParseException(key, params)); }
/** * Converts the current lexical unit to a float. */ protected float number(boolean positive) { try { float sgn = (positive) ? 1 : -1; String val = scanner.getStringValue(); nextIgnoreSpaces(); return sgn * Float.parseFloat(val); } catch (NumberFormatException e) { throw createCSSParseException("number.format"); } }
/** * Converts the current lexical unit to a float. */ protected float number(boolean positive) { try { float sgn = (positive) ? 1 : -1; String val = scanner.getStringValue(); nextIgnoreSpaces(); return sgn * Float.parseFloat(val); } catch (NumberFormatException e) { throw createCSSParseException("number.format"); } }
/** * Converts the current lexical unit to a float. */ protected float number(boolean positive) { try { float sgn = (positive) ? 1 : -1; String val = scanner.getStringValue(); nextIgnoreSpaces(); return sgn * Float.parseFloat(val); } catch (NumberFormatException e) { throw createCSSParseException("number.format"); } }
/** * Converts the current lexical unit to a dimension. */ protected LexicalUnit dimension(boolean positive, LexicalUnit prev) { try { float sgn = (positive) ? 1 : -1; String val = scanner.getStringValue(); int i; loop: for (i = 0; i < val.length(); i++) { switch (val.charAt(i)) { default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': } } nextIgnoreSpaces(); return CSSLexicalUnit.createDimension (sgn * Float.parseFloat(val.substring(0, i)), val.substring(i), prev); } catch (NumberFormatException e) { throw createCSSParseException("number.format"); } }
/** * Converts the current lexical unit to a dimension. */ protected LexicalUnit dimension(boolean positive, LexicalUnit prev) { try { float sgn = (positive) ? 1 : -1; String val = scanner.getStringValue(); int i; loop: for (i = 0; i < val.length(); i++) { switch (val.charAt(i)) { default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': } } nextIgnoreSpaces(); return CSSLexicalUnit.createDimension (sgn * Float.parseFloat(val.substring(0, i)), val.substring(i), prev); } catch (NumberFormatException e) { throw createCSSParseException("number.format"); } }
/** * Converts the current lexical unit to a dimension. */ protected LexicalUnit dimension(boolean positive, LexicalUnit prev) { try { float sgn = (positive) ? 1 : -1; String val = scanner.getStringValue(); int i; loop: for (i = 0; i < val.length(); i++) { switch (val.charAt(i)) { default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': } } nextIgnoreSpaces(); return CSSLexicalUnit.createDimension (sgn * Float.parseFloat(val.substring(0, i)), val.substring(i), prev); } catch (NumberFormatException e) { throw createCSSParseException("number.format"); } }
case LexicalUnits.EOF: if (inSheet) { throw createCSSParseException("eof"); throw createCSSParseException("eof.expected"); continue; default: throw createCSSParseException("identifier"); case LexicalUnits.IDENTIFIER: throw createCSSParseException("colon");
if (current == LexicalUnits.RIGHT_BRACE) { if (op) { throw createCSSParseException ("token", new Object[] {current}); case LexicalUnits.EOF: if (op) { throw createCSSParseException ("token", new Object[] {current});
/** * Parses property value using the current scanner. */ protected LexicalUnit parsePropertyValueInternal() throws CSSException, IOException { nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); throw e; } CSSParseException exception = null; if (current != LexicalUnits.EOF) exception = createCSSParseException("eof.expected"); scanner.close(); scanner = null; if (exception != null) { errorHandler.fatalError(exception); } return exp; }
/** * Parses property value using the current scanner. */ protected LexicalUnit parsePropertyValueInternal() throws CSSException, IOException { nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); throw e; } CSSParseException exception = null; if (current != LexicalUnits.EOF) exception = createCSSParseException("eof.expected"); scanner.close(); scanner = null; if (exception != null) { errorHandler.fatalError(exception); } return exp; }
/** * Parses property value using the current scanner. */ protected LexicalUnit parsePropertyValueInternal() throws CSSException, IOException { nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); throw e; } CSSParseException exception = null; if (current != LexicalUnits.EOF) exception = createCSSParseException("eof.expected"); scanner.close(); scanner = null; if (exception != null) { errorHandler.fatalError(exception); } return exp; }
/** * Advances to the next token and skip the spaces, ignoring comments. */ protected int nextIgnoreSpaces() { try { loop: for (;;) { scanner.clearBuffer(); current = scanner.next(); switch (current) { case LexicalUnits.COMMENT: documentHandler.comment(scanner.getStringValue()); break; default: break loop; case LexicalUnits.SPACE: } } return current; } catch (ParseException e) { errorHandler.error(createCSSParseException(e.getMessage())); return current; } }
/** * Advances to the next token and skip the spaces, ignoring comments. */ protected int nextIgnoreSpaces() { try { loop: for (;;) { scanner.clearBuffer(); current = scanner.next(); switch (current) { case LexicalUnits.COMMENT: documentHandler.comment(scanner.getStringValue()); break; default: break loop; case LexicalUnits.SPACE: } } return current; } catch (ParseException e) { errorHandler.error(createCSSParseException(e.getMessage())); return current; } }
/** * Advances to the next token and skip the spaces, ignoring comments. */ protected int nextIgnoreSpaces() { try { loop: for (;;) { scanner.clearBuffer(); current = scanner.next(); switch (current) { case LexicalUnits.COMMENT: documentHandler.comment(scanner.getStringValue()); break; default: break loop; case LexicalUnits.SPACE: } } return current; } catch (ParseException e) { errorHandler.error(createCSSParseException(e.getMessage())); return current; } }