Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

README.md

cartoshka

CartoCSS (carto) parser for Java. All it does is translate CartoCSS to a traversable hierarchy of Java classes.

![GitHub license](https://img.shields.io/badge/license-MPL 2.0-blue.svg?style=flat-square) Build status Coverage Status

Features

  • Light weight
  • High Performance
  • Full support of CartoCSS syntax
  • Single jar with no additional dependencies

Setup

Add the following to your maven configuration or taylor to your own dependency management system.

<dependencies>
    <dependency>
        <groupId>com.2gis.cartoshka</groupId>
        <artifactId>cartoshka</artifactId>
        <version>0.2</version>
    </dependency>
</dependencies>

Quickstart

Look at the simple example below

CartoParser parser = new CartoParser();
try (FileReader reader = new FileReader(file)) {
    // parsing the file
    Block style = parser.parse(file.getName(), reader);

    // constant folding
    style.accept(new ConstantFoldVisitor(), null);

    // pretty print
    String pretty = style.accept(new PrintVisitor(), null);
    System.out.println(pretty);
} catch (IOException e) {
    e.printStackTrace();
}
You can’t perform that action at this time.