Examples of CssLexer


Examples of com.google.caja.lexer.CssLexer

  private CssTree.StyleSheet parseImpl(String css, Uri source)
      throws ParseException {
    InputSource inputSource = new InputSource(source.toJavaUri());
    CharProducer producer = CharProducer.Factory.create(new StringReader(css),
        inputSource);
    TokenStream<CssTokenType> lexer = new CssLexer(producer);
    TokenQueue<CssTokenType> queue = new TokenQueue<CssTokenType>(lexer, inputSource,
        new Criterion<Token<CssTokenType>>() {
          public boolean accept(Token<CssTokenType> t) {
            return CssTokenType.SPACE != t.type
                && CssTokenType.COMMENT != t.type;
View Full Code Here

Examples of com.google.caja.lexer.CssLexer

  List<Object> parseImpl(String content) throws GadgetException {
    List<Object> parsedCss = Lists.newArrayList();
    CharProducer producer = CharProducer.Factory.create(new StringReader(content),
        new InputSource(DUMMY_SOURCE));
    CssLexer lexer = new CssLexer(producer);
    try {
      StringBuilder builder = new StringBuilder();
      boolean inImport = false;
      while (lexer.hasNext()) {
        Token<CssTokenType> token = lexer.next();
        if (token.type == CssTokenType.SYMBOL && token.text.equalsIgnoreCase("@import")) {
          parsedCss.add(builder.toString());
          builder.setLength(0);
          inImport = true;
        } else if (inImport) {
View Full Code Here

Examples of com.google.caja.lexer.CssLexer

      // Try and lex and see what happens.
      CharProducer cp = CharProducer.Factory.fromString(
          code, FilePosition.UNKNOWN);
      boolean sawColon = false;
      try {
        CssLexer cssLexer = new CssLexer(
            cp, DevNullMessageQueue.singleton(), false);
        contentType = ContentType.CSS;
        while (cssLexer.hasNext()) {
          Token<CssTokenType> t = cssLexer.next();
          if ("if".equals(t.text) || "while".equals(t.text)
              || "for".equals(t.text) || "return".equals(t.text)
              || "?".equals(t.text)) {
            contentType = ContentType.JS;
            break;
View Full Code Here

Examples of com.google.caja.lexer.CssLexer

  private final boolean isTolerant;

  public static TokenQueue<CssTokenType> makeTokenQueue(
      CharProducer cp, MessageQueue mq, boolean allowSubstitutions) {
    return new TokenQueue<CssTokenType>(
        new CssLexer(cp, mq, allowSubstitutions),
        cp.getCurrentPosition().source(),
        new Criterion<Token<CssTokenType>>() {
          public boolean accept(Token<CssTokenType> t) {
            // Other ignorables are handled in skipTopLevelIgnorables below.
            return CssTokenType.SPACE != t.type
View Full Code Here

Examples of org.apache.flex.compiler.internal.css.CSSLexer

        assert problems != null : "Problem collection can't be null";

        try
        {
            // parse and build tree
            final CSSLexer lexer = new CSSLexer(input);
            final CommonTokenStream tokens = new CommonTokenStream(lexer);
            final CSSParser parser = new CSSParser(tokens);
            final CSSParser.stylesheet_return stylesheet = parser.stylesheet();
            final CommonTree ast = (CommonTree)stylesheet.getTree();
            final CommonTreeNodeStream nodes = new CommonTreeNodeStream(ast);
View Full Code Here

Examples of org.freud.analysed.css.parser.CssLexer

        }
        return cssRuleList;
    }

    private static Document parseCssToDocument(final Reader reader) throws RecognitionException, IOException {
        CssParser parser = new CssParser(new CommonTokenStream(new CssLexer(new ANTLRReaderStream(reader))));
        final JdomTreeAdaptor treeAdaptor = new JdomTreeAdaptor(CSS_ROOT_ELEMENT_NAME, CSS_TOKEN_TYPES);
        parser.setTreeAdaptor(treeAdaptor);
        parser.stylesheet();
        return treeAdaptor.getDocument();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.