Package com.github.sommeri.less4j.core.parser

Examples of com.github.sommeri.less4j.core.parser.ANTLRParser


  public Set<LessSource> getImportedSources() {
    return importedSources;
  }

  private StyleSheet parseContent(Import importNode, String importedContent, LessSource source) {
    ANTLRParser parser = new ANTLRParser();
    ANTLRParser.ParseResult parsedSheet = parser.parseStyleSheet(importedContent, source);
    if (parsedSheet.hasErrors()) {
      StyleSheet result = new StyleSheet(importNode.getUnderlyingStructure());
      result.addMember(new FaultyNode(importNode));
      problemsHandler.addErrors(parsedSheet.getErrors());
      return result;
View Full Code Here


*/
public class SelectorsGrammarTest {

  @Test
  public void emptyCombinator() {
    ANTLRParser compiler = new ANTLRParser();
    ANTLRParser.ParseResult result = compiler.parseSelector("h1 h2 {", null);
    assertValidSelector(result);
  }
View Full Code Here

    assertValidSelector(result);
  }

  @Test
  public void spacelessCombinator() {
    ANTLRParser compiler = new ANTLRParser();
    ANTLRParser.ParseResult result = compiler.parseSelector("h1>h2 {", null);
    assertValidSelector(result);
  }
View Full Code Here

    assertValidSelector(result);
  }

  @Test
  public void spacedCombinator() {
    ANTLRParser compiler = new ANTLRParser();
    ANTLRParser.ParseResult result = compiler.parseSelector("h1 + h2 {", null);
    assertValidSelector(result);
  }
View Full Code Here

    assertValidSelector(result);
  }

  @Test
  public void afterCSS2() {
    ANTLRParser compiler = new ANTLRParser();
    ANTLRParser.ParseResult result = compiler.parseSelector("li:after {", null);
    assertValidSelector(result);
    assertChilds(result.getTree(), LessLexer.EMPTY_COMBINATOR, LessLexer.SIMPLE_SELECTOR);
  }
View Full Code Here

    assertChilds(result.getTree(), LessLexer.EMPTY_COMBINATOR, LessLexer.SIMPLE_SELECTOR);
  }

  @Test
  public void afterCSS3() {
    ANTLRParser compiler = new ANTLRParser();
    String selector = "li::after {";
    ANTLRParser.ParseResult result = compiler.parseSelector(selector, null);
    assertValidSelector(result);
    assertChilds(result.getTree(), LessLexer.EMPTY_COMBINATOR, LessLexer.SIMPLE_SELECTOR);
  }
View Full Code Here

    assertChilds(result.getTree(), LessLexer.EMPTY_COMBINATOR, LessLexer.SIMPLE_SELECTOR);
  }

  @Test
  public void notPseudo() {
    ANTLRParser compiler = new ANTLRParser();
    String selector = "li:not(:only-child) { ";
    ANTLRParser.ParseResult result = compiler.parseSelector(selector, null);
    assertValidSelector(result);
    }
View Full Code Here

    assertValidSelector(result);
    }

  @Test
  public void notNumber() {
    ANTLRParser compiler = new ANTLRParser();
    ANTLRParser.ParseResult result = compiler.parseSelector("class#id[attr=32]:not(1) {", null);
    assertValidSelector(result);
  }
View Full Code Here

    assertValidSelector(result);
  }

  @Test
  public void notAttribute() {
    ANTLRParser compiler = new ANTLRParser();
    ANTLRParser.ParseResult result = compiler.parseSelector("p:not([class*=\"lead\"]) {", null);
    assertValidSelector(result);
  }
View Full Code Here

        "li:nth-child(-5n),\n" +
        "li:nth-child(-n+2) {\n" +
        "  color: white;\n" +
        "}";
   
    ANTLRParser compiler = new ANTLRParser();
    ParseResult result = compiler.parseStyleSheet(combined_stylesheet, null);
    assertValid(result);
  }
View Full Code Here

TOP

Related Classes of com.github.sommeri.less4j.core.parser.ANTLRParser

Copyright © 2018 www.massapicom. 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.