var isSpec = require( '../utils/isSpec' );
var Spec = require( '../models/Spec' );
var { oneOrMore, cat, ExprSpec } = require( './regex' );
var fspec = require( './fspec' );
var walk = require( '../walk' );

var AndSpec = fspec( {
  args: cat( 'exprs', oneOrMore( ExprSpec ) ),
  ret: isSpec,
} );

function andOp( conformedArgs ) {
  var { exprs } = conformedArgs;

  var andS = new Spec( {
    type: 'AND',
    exprs,
    fragments: exprs,
  } );
  andS.conform = function andConform( x ) {
    return walk( andS, x, { conform: true } );
  }
  return andS;
}

var and = AndSpec.instrumentConformed( andOp );

module.exports = {
  and,
  AndSpec,
};

@@ -96,13 +96,8 @@
 ore,
- cat,
  Exp
@@ -230,22 +230,8 @@
 rgs:
- cat( 'exprs',
  one
@@ -246,18 +246,16 @@
 ExprSpec
- )
  ),%0A  re
@@ -291,59 +291,17 @@
 Op( 
-conformedArgs ) %7B%0A  var %7B exprs %7D = conformedArgs;%0A
+exprs ) %7B
 %0A  v

simplify spec for and