(input, options)
| 10 | extend(yy, Helpers); |
| 11 | |
| 12 | export function parseWithoutProcessing(input, options) { |
| 13 | // Just return if an already-compiled AST was passed in. |
| 14 | if (input.type === 'Program') { |
| 15 | // When a pre-parsed AST is passed in, validate all node values to prevent |
| 16 | // code injection via type-confused literals. |
| 17 | validateInputAst(input); |
| 18 | return input; |
| 19 | } |
| 20 | |
| 21 | parser.yy = yy; |
| 22 | |
| 23 | // Altering the shared object here, but this is ok as parser is a sync operation |
| 24 | yy.locInfo = function(locInfo) { |
| 25 | return new yy.SourceLocation(options && options.srcName, locInfo); |
| 26 | }; |
| 27 | |
| 28 | let ast = parser.parse(input); |
| 29 | |
| 30 | return ast; |
| 31 | } |
| 32 | |
| 33 | export function parse(input, options) { |
| 34 | let ast = parseWithoutProcessing(input, options); |
no test coverage detected