Giter Club home page Giter Club logo

peg-html-parser's Introduction

PEG HTML parser

build status

This is definitely not the fastest HTML/XML parser that runs on JavaScript but is very small and simple, just so it can be easily modified.

The purpose of this project is to be a quick start for playing with PEG.js and especially for those who love LiveScript.

If you want to know more about PEGs syntax and flavors here are the fun staff - Parsing expression grammars.

The whole PEG HTML parser squeezed without comments and empty lines. It is really a collection of grammar rules from which PEG.js can generate JS parser. My inspiration for writing HTML grammar rules was of course W3C HTML5 syntax recommendation.

PEG HTML parser grammar

Installation

Checkout the repo and install node dependencies.

npm i

Optionally, for syntax highlighting in Sublime Text editor, you can install PEGjs LiveScript plugin.

Usage

Watch

On every save of the parser ./src/peg-html-parser.pegls all *.html files from ./test/fixtures will be parsed and the result of parsing and AST will be written in ./.watch folder in YAML format.

npm run watch

Build

Generates the JS parser to ./dist folder (only CommonJS module style).

npm run build

Tests

Executes tests and parses all *.html files from ./test/fixtures.

npm test

License

The MIT License (MIT)

peg-html-parser's People

Contributors

tgrospic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sygint ephellon

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.