1.2.0 • Published 8 years ago

simplepeg v1.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

JavaScript

Greenkeeper badge Build Status Coverage Status

JavaScript version ( Browser and Node.js ) of SimplePEG

import {SPEG} from 'simplepeg';
const parser = new SPEG();

parser.parse_grammar('GRAMMAR test a->"A";);
const ast = parser.parse_text('A');
console.log(JSON.strinfigy(ast, null 4));

Grammar example

url.peg

GRAMMAR url

url       ->  scheme "://" host pathname search hash?;
scheme    ->  "http" "s"?;
host      ->  hostname port?;
hostname  ->  segment ("." segment)*;
segment   ->  [a-z0-9-]+;
port      ->  ":" [0-9]+;
pathname  ->  "/" [^ ?]*;
search    ->  ("?" [^ #]*)?;
hash      ->  "#" [^ ]*;
1.2.0

8 years ago

1.1.0

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

9 years ago

1.0.0

9 years ago