'use strict';

var langiumParser = require('./langium-parser.js');
var parserBuilderBase = require('./parser-builder-base.js');

/******************************************************************************
 * Copyright 2022 TypeFox GmbH
 * This program and the accompanying materials are made available under the
 * terms of the MIT License, which is available in the project root.
 ******************************************************************************/
function createCompletionParser(services) {
    const grammar = services.Grammar;
    const lexer = services.parser.Lexer;
    const parser = new langiumParser.LangiumCompletionParser(services);
    parserBuilderBase.createParser(grammar, parser, lexer.definition);
    parser.finalize();
    return parser;
}

exports.createCompletionParser = createCompletionParser;
