Coder Social home page Coder Social logo

css-parser's Introduction

This is a parser for cascading style sheets.  The grammar rules and actions are are stated in css.peg.
That is converted into parser.lisp using metapeg[2].

This is an ASDF system.  In fact you must load it that way.

  CL-USER> (in-package "CSS-PARSER")
  #<Package "CSS-PARSER">
  CSS-PARSER> (parse-string "DIV.example>LI{color:#333}")
  (STYLESHEET (CSS-RULE (CHILD (PATH (ELEMENT "DIV") (CLASS "example")) (ELEMENT "LI")) -> ("color" (COLOR "333"))))
  NIL
  CSS-PARSER> 

If you load fiveAM[3] prior to loading this then a bit-o-testing code will be included; which you can
run as so:

  CSS-PARSER> (run! 'css-parser)
  ......................
   Did 22 checks.
     Pass: 22 (100%)
     Skip: 0 ( 0%)
     Fail: 0 ( 0%)

  NIL
  CSS-PARSER> 

Those tests are in tests.lisp and provide examples.

[1] A PEG parser is a recursive decent parser with memoization mixed in so the performance
remains linear.

[2] See <http://www.cliki.net/metapeg>, though I'm actually using <http://github.com/bhyde/metapeg>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.