elmasse / yapa

Yet Another Parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status #yapa (yet another parser)

##Install

npm install git://github.com/elmasse/yapa.git --save

##Usage

var Parser = require('yapa'),
    parser, tokens

parser = Parser.create();

//tokenize
tokens = parser.tokenize('var _this, _is, _a, _js, _parser;');

console.log(tokens);

This will print:

[ { type: 'KEYWORD', value: 'var' },
  { type: 'IDENTIFIER', value: '_this' },
  { type: 'PUNCTUATOR', value: ',' },
  { type: 'IDENTIFIER', value: '_is' },
  { type: 'PUNCTUATOR', value: ',' },
  { type: 'IDENTIFIER', value: '_a' },
  { type: 'PUNCTUATOR', value: ',' },
  { type: 'IDENTIFIER', value: '_js' },
  { type: 'PUNCTUATOR', value: ',' },
  { type: 'IDENTIFIER', value: '_parser' },
  { type: 'PUNCTUATOR', value: ';' },
  { type: 'EOF', value: 'eof' } ] 

About

Yet Another Parser


Languages

Language:JavaScript 100.0%