packages/pegjs/lib/parser.js
function addComment( text, multiline ) {

          if ( options.extractComments ) {

              const loc = location();

              comments[ loc.start.offset ] = {
                  text: text,
                  multiline: multiline,
                  location: loc,
              };

          }

          return text;

      }
function addComment( text, multiline ) {

          if ( options.extractComments ) {

              const loc = location();

              comments[ loc.start.offset ] = {
                  text: text,
                  multiline: multiline,
                  location: loc,
              };

          }

          return text;

      }
function addComment ( text , multiline ) { if ( options . extractComments ) { const loc = location ( ) ; comments [ loc . start . offset ] = { text : text , multiline : multiline , location : loc , } ; } return text ; }
Helper that collects all the comments to pass to the Grammar AST
Helper that collects all the comments to pass to the Grammar AST