Search in sources :

Example 1 with ParserImpl

use of org.snakeyaml.engine.v2.parser.ParserImpl in project sonar-iac by SonarSource.

the class CloudformationParser method parse.

@Override
public FileTree parse(String source, @Nullable InputFileContext inputFileContext) {
    LoadSettings settings = LoadSettings.builder().setParseComments(shouldParseComments(inputFileContext)).build();
    StreamReader reader = new StreamReader(settings, source);
    ScannerImpl scanner = new ScannerImpl(settings, reader);
    Parser parser = new ParserImpl(settings, scanner);
    Composer composer = new Composer(settings, parser);
    List<Node> nodes = composerNodes(composer);
    return CloudformationConverter.convertFile(nodes);
}
Also used : Composer(org.snakeyaml.engine.v2.composer.Composer) StreamReader(org.snakeyaml.engine.v2.scanner.StreamReader) ScannerImpl(org.snakeyaml.engine.v2.scanner.ScannerImpl) Node(org.snakeyaml.engine.v2.nodes.Node) ParserImpl(org.snakeyaml.engine.v2.parser.ParserImpl) LoadSettings(org.snakeyaml.engine.v2.api.LoadSettings) TreeParser(org.sonar.iac.common.extension.TreeParser) Parser(org.snakeyaml.engine.v2.parser.Parser)

Aggregations

LoadSettings (org.snakeyaml.engine.v2.api.LoadSettings)1 Composer (org.snakeyaml.engine.v2.composer.Composer)1 Node (org.snakeyaml.engine.v2.nodes.Node)1 Parser (org.snakeyaml.engine.v2.parser.Parser)1 ParserImpl (org.snakeyaml.engine.v2.parser.ParserImpl)1 ScannerImpl (org.snakeyaml.engine.v2.scanner.ScannerImpl)1 StreamReader (org.snakeyaml.engine.v2.scanner.StreamReader)1 TreeParser (org.sonar.iac.common.extension.TreeParser)1