1.2.0 • Published 7 years ago

simplepeg v1.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 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

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

8 years ago

1.0.0

8 years ago