(input: string)
| 76 | * additional input follows the expression. |
| 77 | */ |
| 78 | export function maybeParseExpression(input: string): Expression | null { |
| 79 | const parser = new (Parser as any)(acornOptions, input, 0); // private constructor |
| 80 | parser.nextToken(); |
| 81 | try { |
| 82 | const node = parser.parseExpression(); |
| 83 | return parser.type === tokTypes.eof ? node : null; |
| 84 | } catch { |
| 85 | return null; |
| 86 | } |
| 87 | } |