0.0.10 • Published 12 years ago

saxtojson v0.0.10

Weekly downloads
44
License
-
Repository
github
Last release
12 years ago

sax2json

Converts .sax file (yes, I made up this format) into json.

Installation

Don't have one. Just clone this repository.

Usage

Brace yourself... execute bin/sax2json or require lib/sax2jsonjs.

Sax definition

Sax file is a collection of commands.

Command:

  • collection of arguments separated by white space. First argument must be a string. Block can only be the last argument.

  • comment (line starting with # and optional trailing white spaces)

  • empty line

Argument is a string or block.

String is a set of chars enclosed by double quotation marks. Quotation marks can be ommited.

Block is a set equally indented commands.

Parsing

Input

click "a[name=b]" 
	equal "title" "foo"
	ok 2 > 1

Output

[[
	"click", "a[name=b]", [[
		"equal",
		"title",
		"foo"
	], [
		"ok":
		"2",
		">",
		"1"
	]]
]]

Tests

nodeunit test/sax2json.js 	
0.0.10

12 years ago

0.0.9

12 years ago

0.0.8

12 years ago

0.0.7

12 years ago

0.0.6

12 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago