tracing/third_party/oboe/dist/oboe-node.js
function generateClauseReaderIfTokenFound (
     
                        tokenDetector, clauseEvaluatorGenerators,
                         
                        jsonPath, parserGeneratedSoFar, onSuccess) {
                        
      var detected = tokenDetector(jsonPath);

      if(detected) {
         var compiledParser = expressionsReader(
                                 clauseEvaluatorGenerators, 
                                 parserGeneratedSoFar, 
                                 detected
                              ),
         
             remainingUnparsedJsonPath = jsonPath.substr(len(detected[0]));                
                               
         return onSuccess(remainingUnparsedJsonPath, compiledParser);
      }         
   }
function generateClauseReaderIfTokenFound (
     
                        tokenDetector, clauseEvaluatorGenerators,
                         
                        jsonPath, parserGeneratedSoFar, onSuccess) {
                        
      var detected = tokenDetector(jsonPath);

      if(detected) {
         var compiledParser = expressionsReader(
                                 clauseEvaluatorGenerators, 
                                 parserGeneratedSoFar, 
                                 detected
                              ),
         
             remainingUnparsedJsonPath = jsonPath.substr(len(detected[0]));                
                               
         return onSuccess(remainingUnparsedJsonPath, compiledParser);
      }         
   }
function generateClauseReaderIfTokenFound ( tokenDetector , clauseEvaluatorGenerators , jsonPath , parserGeneratedSoFar , onSuccess ) { var detected = tokenDetector ( jsonPath ) ; if ( detected ) { var compiledParser = expressionsReader ( clauseEvaluatorGenerators , parserGeneratedSoFar , detected ) , remainingUnparsedJsonPath = jsonPath . substr ( len ( detected [ 0 ] ) ) ; return onSuccess ( remainingUnparsedJsonPath , compiledParser ) ; } }
If jsonPath matches the given detector function, creates a function which
evaluates against every clause in the clauseEvaluatorGenerators. The
created function is propagated to the onSuccess function, along with
the remaining unparsed JSONPath substring.

The intended use is to create a clauseMatcher by filling in
the first two arguments, thus providing a function that knows
some syntax to match and what kind of generator to create if it
finds it. The parameter list once completed is:

(jsonPath, parserGeneratedSoFar, onSuccess)

onSuccess may be compileJsonPathToFunction, to recursively continue
parsing after finding a match or returnFoundParser to stop here.
If jsonPath matches the given detector function creates a function which evaluates against every clause in the clauseEvaluatorGenerators . The created function is propagated to the onSuccess function along with the remaining unparsed JSONPath substring .