private static SchemaNode parseIndexingScript(SchemaNode indexingElmNode, ParseContext context, List<Diagnostic> diagnostics) {
        SubLanguageData script = indexingElmNode.getILScript();
        if (script == null) return null;

        Position indexingStart = indexingElmNode.getRange().getStart();
        CharSequence sequence = script.content();
        IndexingParser parser = new IndexingParser(context.fileURI(), sequence);
        parser.setParserTolerant(false);

        Position scriptStart = new Position(indexingStart.getLine(), indexingStart.getCharacter() + script.leadingStripped());

        try {
            var expression = parser.root();

            // store the expression to be checked later
            ((indexingElm)indexingElmNode.getOriginalSchemaNode()).expression = expression;

            return new SchemaNode(parser.rootNode(), scriptStart);
        } catch(ai.vespa.schemals.parser.indexinglanguage.ParseException pe) {
            try {
                Range range = ILUtils.getNodeRange(pe.getToken());
                range.setStart(CSTUtils.addPositions(scriptStart, range.getStart()));
                range.setEnd(CSTUtils.addPositions(scriptStart, range.getEnd()));

                diagnostics.add(new SchemaDiagnostic.Builder()
                    .setRange(range)
                    .setMessage(pe.getMessage())
                    .setSeverity(DiagnosticSeverity.Error)
                    .build());
            } catch(Exception e) {
                // ignore
            }
        } catch(IllegalArgumentException ex) {
            diagnostics.add(new SchemaDiagnostic.Builder()
                .setRange(indexingElmNode.getRange())
                .setMessage(ex.getMessage())
                .setSeverity(DiagnosticSeverity.Error)
                .build());
        }

        return null;
    }
SchemaDocument parses and represents .sd files
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/SchemaDocument.java