congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Parser
Code IndexAdd Tabnine to your IDE (free)

How to use
Parser
in
org.apache.batik.css.parser

Best Java code snippets using org.apache.batik.css.parser.Parser (Showing top 20 results out of 315)

origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Parses a style declaration using the current scanner.
 */
protected void parseStyleDeclarationInternal()
  throws CSSException, IOException {
  nextIgnoreSpaces();
  try {
    parseStyleDeclaration(false);
  } catch (CSSParseException e) {
    reportError(e);
  } finally {
    scanner.close();
    scanner = null;
  }
}
origin: org.apache.xmlgraphics/batik-css

/**
 * 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");
  }
}
origin: org.apache.xmlgraphics/batik-css

/**
 * <b>SAC</b>: Implements
 * {@link org.w3c.css.sac.Parser#parsePropertyValue(InputSource)}.
 */
public LexicalUnit parsePropertyValue(InputSource source)
  throws CSSException, IOException {
  scanner = createScanner(source);
  return parsePropertyValueInternal();
}
origin: org.apache.xmlgraphics/batik-css

/**
 * Reports a parsing error.
 */
protected void reportError(String key, Object[] params) {
  reportError(createCSSParseException(key, params));
}
origin: org.apache.xmlgraphics/batik-css

/**
 * <b>SAC</b>: Implements {@link
 * org.w3c.css.sac.Parser#parseRule(InputSource)}.
 */
public void parseRule(InputSource source)
  throws CSSException, IOException {
  scanner = createScanner(source);
  parseRuleInternal();
}
origin: org.apache.xmlgraphics/batik-css

scanner = createScanner(source);
  switch (current) {
  case LexicalUnits.CHARSET_SYMBOL:
    if (nextIgnoreSpaces() != LexicalUnits.STRING) {
      reportError("charset.string");
    } else {
      if (nextIgnoreSpaces() != LexicalUnits.SEMI_COLON) {
        reportError("semicolon");
      next();
  skipSpacesAndCDOCDC();
  for (;;) {
    if (current == LexicalUnits.IMPORT_SYMBOL) {
      nextIgnoreSpaces();
      parseImportRule();
      nextIgnoreSpaces();
    } else {
      break;
    switch (current) {
    case LexicalUnits.PAGE_SYMBOL:
      nextIgnoreSpaces();
      parsePageRule();
      break;
    case LexicalUnits.MEDIA_SYMBOL:
      nextIgnoreSpaces();
      parseMediaRule();
origin: org.apache.xmlgraphics/batik-css

  plus = false;
case LexicalUnits.PLUS:
  next();
  sgn = true;
default:
      nextIgnoreSpaces();
      return CSSLexicalUnit.createInteger( iVal, prev);
                     number(plus), prev);
  case LexicalUnits.PERCENTAGE:
    return CSSLexicalUnit.createFloat(LexicalUnit.SAC_PERCENTAGE,
                     number(plus), prev);
  case LexicalUnits.PT:
    return CSSLexicalUnit.createFloat(LexicalUnit.SAC_POINT,
                     number(plus), prev);
  case LexicalUnits.PC:
    return CSSLexicalUnit.createFloat(LexicalUnit.SAC_PICA,
                     number(plus), prev);
  case LexicalUnits.PX:
    return CSSLexicalUnit.createFloat(LexicalUnit.SAC_PIXEL,
                     number(plus), prev);
  case LexicalUnits.CM:
    return CSSLexicalUnit.createFloat(LexicalUnit.SAC_CENTIMETER,
                     number(plus), prev);
  case LexicalUnits.MM:
    return CSSLexicalUnit.createFloat(LexicalUnit.SAC_MILLIMETER,
                     number(plus), prev);
  case LexicalUnits.IN:
origin: fr.avianey.apache-xmlgraphics/batik

case LexicalUnits.EOF:
  if (inSheet) {
    throw createCSSParseException("eof");
    throw createCSSParseException("eof.expected");
  nextIgnoreSpaces();
  return;
case LexicalUnits.SEMI_COLON:
  nextIgnoreSpaces();
  continue;
default:
  throw createCSSParseException("identifier");
case LexicalUnits.IDENTIFIER:
if (nextIgnoreSpaces() != LexicalUnits.COLON) {
  throw createCSSParseException("colon");
nextIgnoreSpaces();
  exp = parseExpression(false);
} catch (CSSParseException e) {
  reportError(e);
  if (current == LexicalUnits.IMPORTANT_SYMBOL) {
    important = true;
    nextIgnoreSpaces();
origin: org.apache.xmlgraphics/batik-css

  result = selectorFactory.createElementSelector
    (null, scanner.getStringValue());
  next();
  break;
case LexicalUnits.ANY:
  next();
default:
  result = selectorFactory.createElementSelector(null, null);
    c = conditionFactory.createIdCondition
      (scanner.getStringValue());
    next();
    break;
  case LexicalUnits.DOT:
    if (next() != LexicalUnits.IDENTIFIER) {
      throw createCSSParseException("identifier");
    next();
    break;
  case LexicalUnits.LEFT_BRACKET:
    if (nextIgnoreSpaces() != LexicalUnits.IDENTIFIER) {
      throw createCSSParseException("identifier");
    int op = nextIgnoreSpaces();
    switch (op) {
    default:
      throw createCSSParseException("right.bracket");
    case LexicalUnits.RIGHT_BRACKET:
      next();
origin: org.apache.xmlgraphics/batik-css

/**
 * Parses a ruleset.
 */
protected void parseRuleSet() {
  SelectorList sl = null;
  try {
    sl = parseSelectorList();
  } catch (CSSParseException e) {
    reportError(e);
    return;
  }
  try {
    documentHandler.startSelector(sl);
    if (current != LexicalUnits.LEFT_CURLY_BRACE) {
      reportError("left.curly.brace");
      if (current == LexicalUnits.RIGHT_CURLY_BRACE) {
        nextIgnoreSpaces();
      }
    } else {
      nextIgnoreSpaces();
      try {
        parseStyleDeclaration(true);
      } catch (CSSParseException e) {
        reportError(e);
      }
    }
  } finally {
    documentHandler.endSelector(sl);
  }
}
origin: apache/batik

/**
 * Parses an import rule. Assumes the current token is '@import'.
 */
protected void parseImportRule() {
  String uri = null;
  switch (current) {
  default:
    reportError("string.or.uri");
    return;
  case LexicalUnits.STRING:
  case LexicalUnits.URI:
    uri = scanner.getStringValue();
    nextIgnoreSpaces();
  }
  CSSSACMediaList ml;
  if (current != LexicalUnits.IDENTIFIER) {
    ml = new CSSSACMediaList();
    ml.append("all");
  } else {
    ml = parseMediaList();
  }
  documentHandler.importStyle(uri, ml, null);
  if (current != LexicalUnits.SEMI_COLON) {
    reportError("semicolon");
  } else {
    next();
  }
}
origin: org.apache.xmlgraphics/batik-css

LexicalUnit result = parseTerm(null);
LexicalUnit curr = result;
    curr = CSSLexicalUnit.createSimple
      (LexicalUnit.SAC_OPERATOR_COMMA, curr);
    nextIgnoreSpaces();
    break;
  case LexicalUnits.DIVIDE:
    curr = CSSLexicalUnit.createSimple
      (LexicalUnit.SAC_OPERATOR_SLASH, curr);
    nextIgnoreSpaces();
        throw createCSSParseException
          ("token", new Object[] {current});
    curr = parseTerm(curr);
  } else {
    switch (current) {
    case LexicalUnits.EOF:
      if (op) {
        throw createCSSParseException
          ("token", new Object[] {current});
      curr = parseTerm(curr);
origin: fr.avianey.apache-xmlgraphics/batik

Selector result = parseSimpleSelector();
  case LexicalUnits.COLON:
    if (pseudoElement != null) {
      throw createCSSParseException("pseudo.element.position");
       parseSimpleSelector());
    break;
  case LexicalUnits.PLUS:
    if (pseudoElement != null) {
      throw createCSSParseException("pseudo.element.position");
    nextIgnoreSpaces();
    result = selectorFactory.createDirectAdjacentSelector
      ((short)1,
       result,
       parseSimpleSelector());
    break;
  case LexicalUnits.PRECEDE:
    if (pseudoElement != null) {
      throw createCSSParseException("pseudo.element.position");
    nextIgnoreSpaces();
    result = selectorFactory.createChildSelector
      (result,
       parseSimpleSelector());
origin: org.apache.xmlgraphics/batik-css

/**
 * Parses the priority using the current scanner.
 */
protected boolean parsePriorityInternal()
  throws CSSException, IOException {
  nextIgnoreSpaces();
  scanner.close();
  scanner = null;
  switch (current) {
  case LexicalUnits.EOF:
    return false;
  case LexicalUnits.IMPORT_SYMBOL:
    return true;
  default:
    reportError("token", new Object[] {current});
    return false;
  }
}
origin: org.apache.xmlgraphics/batik-css

/**
 * Parses selectors using the current scanner.
 */
protected SelectorList parseSelectorsInternal()
  throws CSSException, IOException {
  nextIgnoreSpaces();
  SelectorList ret = parseSelectorList();
  scanner.close();
  scanner = null;
  return ret;
}
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Parses a rule using the current scanner.
 */
protected void parseRuleInternal() throws CSSException, IOException {
  nextIgnoreSpaces();
  parseRule();
  scanner.close();
  scanner = null;
}
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * <b>SAC</b>: Implements {@link
 * org.w3c.css.sac.Parser#parseStyleDeclaration(InputSource)}.
 */
public void parseStyleDeclaration(InputSource source)
  throws CSSException, IOException {
  scanner = createScanner(source);
  parseStyleDeclarationInternal();
}
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * <b>SAC</b>: Implements {@link
 * org.w3c.css.sac.Parser#parseSelectors(InputSource)}.
 */
public SelectorList parseSelectors(InputSource source)
  throws CSSException, IOException {
  scanner = createScanner(source);
  return parseSelectorsInternal();
}
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * <b>SAC</b>: Implements
 * {@link org.w3c.css.sac.Parser#parsePriority(InputSource)}.
 */
public boolean parsePriority(InputSource source)
  throws CSSException, IOException {
  scanner = createScanner(source);
  return parsePriorityInternal();
}
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Parses a selector list
 */
protected SelectorList parseSelectorList() {
  CSSSelectorList result = new CSSSelectorList();
  result.append(parseSelector());
  for (;;) {
    if (current != LexicalUnits.COMMA) {
      return result;
    }
    nextIgnoreSpaces();
    result.append(parseSelector());
  }
}
org.apache.batik.css.parserParser

Javadoc

This class implements the org.w3c.css.sac.Parser interface.

Most used methods

  • parseStyleDeclaration
    Parses the given reader.
  • parseStyleSheet
    SAC: Implements org.w3c.css.sac.Parser#parseStyleSheet(InputSource).
  • createCSSParseException
    Creates a parse exception.
  • createScanner
    Creates a scanner, given an InputSource.
  • dimension
    Converts the current lexical unit to a dimension.
  • formatMessage
    Implements org.apache.batik.i18n.Localizable#formatMessage(String,Object[]).
  • hexcolor
    Converts a hash unit to a RGB color.
  • isPseudoElement
    Tells whether or not the given string represents a pseudo-element.
  • next
    Advances to the next token, ignoring comments.
  • nextIgnoreSpaces
    Advances to the next token and skip the spaces, ignoring comments.
  • number
    Converts the current lexical unit to a float.
  • parseAtRule
    Parses an unknown rule.
  • number,
  • parseAtRule,
  • parseExpression,
  • parseFontFaceRule,
  • parseFunction,
  • parseImportRule,
  • parseMediaList,
  • parseMediaRule,
  • parsePageRule,
  • parsePriorityInternal

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now