src/ramdascript.js
function chunksToSourceMap(chunks, cfg) {
    var loc
    var outLine   = 0
    var outColumn = 0
    var smap      = sourcemap.newSourceMap()
    var acc = ''

    chunks.forEach(function(chunk) {
        if (chunk.content === '\n') {
            outLine   = outLine + 1
            outColumn = 0
        }
        loc = chunk.loc
        if (loc) {
            smap.add(
                // jison line tracking is 1 based,
                // source maps reads it as 0 based
                loc.firstLine - 1,
                loc.firstColumn,
                outLine,
                outColumn
            )
        }
        if (chunk.content !== '\n') {
            outColumn = outColumn + chunk.content.length
        }
    })

    return smap.generate(cfg)
}
function chunksToSourceMap(chunks, cfg) {
    var loc
    var outLine   = 0
    var outColumn = 0
    var smap      = sourcemap.newSourceMap()
    var acc = ''

    chunks.forEach(function(chunk) {
        if (chunk.content === '\n') {
            outLine   = outLine + 1
            outColumn = 0
        }
        loc = chunk.loc
        if (loc) {
            smap.add(
                // jison line tracking is 1 based,
                // source maps reads it as 0 based
                loc.firstLine - 1,
                loc.firstColumn,
                outLine,
                outColumn
            )
        }
        if (chunk.content !== '\n') {
            outColumn = outColumn + chunk.content.length
        }
    })

    return smap.generate(cfg)
}
convert chunks to source map chunks array of chunks cfg    sourcemap config