Skip to content

Commit

Permalink
Renamed --pipe option to --pipe-in
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanls committed Jul 2, 2011
1 parent b177176 commit f2626c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ This command uses grammar that also interprets, so the `output.file` will contai

from the `bin` directory:

`./ometajsnode -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr ../spec/data/program.file | ./ometajsnode -g ../spec/data/interpreter.ometajs --grammar-match interp -o output.file --pipe --debug`
`./ometajsnode -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr ../spec/data/program.file | ./ometajsnode -g ../spec/data/interpreter.ometajs --grammar-match interp -o output.file --pipe-in --debug`

We introduce the `--pipe` option here:
We introduce the `--pipe-in` option here:

* `--pipe` indicates that the input has been previously generated by `ometajsnode`. notice that we are piping output from one `ometajsnode` to another; `--pipe` is a flag that lets `ometajsnode` know that it is working with input formatted by itself
* `--pipe-in` indicates that the input has been previously generated by `ometajsnode`. notice that we are piping output from one `ometajsnode` to another; `--pipe-in` is a flag that lets `ometajsnode` know that it is working with input formatted by itself



#### Parser to intermediate representation, then intermediate representation to "assembly" code example:

from the `bin` directory:

`./ometajsnode -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr ../spec/data/program.file | ./ometajsnode -g ../spec/data/compiler.ometajs --grammar-match comp -u example-utilities --pipe -o output.file --debug --no-pipe-out`
`./ometajsnode -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr ../spec/data/program.file | ./ometajsnode -g ../spec/data/compiler.ometajs --grammar-match comp -u example-utilities --pipe-in -o output.file --debug --no-pipe-out`

We introduce the utilities option here:

Expand Down
4 changes: 2 additions & 2 deletions bin/ometajsnode
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var help2 = [
""
].join( '\n' );
var help3 = [
" --pipe Pipe mode, expect stdin to be parse object represented as JSON string (instead of a program)",
" --pipe-in Pipe mode, expect stdin to be parse object represented as JSON string (instead of a program)",
" -u, --utility <module_file[,module_file]> Specifies a list of modules that will be available for access by ometajs files via __Utilities",
" Modules used as untilities must export 'utilityName' property to be read",
""
Expand Down Expand Up @@ -85,7 +85,7 @@ while ( arg = argv.shift() ) {
case 'o':
options.output = argv.shift();
break;
case 'pipe':
case 'pipe-in':
options.pipe = true;
break;
case 'utility':
Expand Down
8 changes: 4 additions & 4 deletions spec/ometajsnode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe( 'ometajsnode', function() {
});

it( 'should parse piped output ["mul",["num",6],["add",["num",4],["num",3]]] from stdin using interpreter.ometajs and output to stdout', function() {
exec( 'echo \'["mul",["num",6],["add",["num",4],["num",3]]]\' | ./bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe',
exec( 'echo \'["mul",["num",6],["add",["num",4],["num",3]]]\' | ./bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
expect( stdout ).toEqual( '42' );
Expand All @@ -111,7 +111,7 @@ describe( 'ometajsnode', function() {
});

it( 'should parse piped output ["mul",["num",6],["add",["num",4],["num",3]]] from stdin using interpreter.ometajs and output to file', function() {
exec( 'echo \'["mul",["num",6],["add",["num",4],["num",3]]]\' | ./bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe -o ./spec/data/tmp/output.3.file',
exec( 'echo \'["mul",["num",6],["add",["num",4],["num",3]]]\' | ./bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in -o ./spec/data/tmp/output.3.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );

Expand All @@ -131,7 +131,7 @@ describe( 'ometajsnode', function() {
});

it( 'should parse intermediate representation ["mul",["num",6],["add",["num",4],["num",3]]] from ir.file using interpreter.ometajs and output to stdout', function() {
exec( './bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe ./spec/data/ir.file',
exec( './bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in ./spec/data/ir.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
expect( stdout ).toEqual( '42' );
Expand All @@ -141,7 +141,7 @@ describe( 'ometajsnode', function() {
});

it( 'should parse intermediate representation ["mul",["num",6],["add",["num",4],["num",3]]] from ir.file using interpreter.ometajs and output to file', function() {
exec( './bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe -o ./spec/data/tmp/output.4.file ./spec/data/ir.file',
exec( './bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in -o ./spec/data/tmp/output.4.file ./spec/data/ir.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );

Expand Down

0 comments on commit f2626c9

Please sign in to comment.