Skip to content

pdml-lang/simple-pdml-parser

Repository files navigation

Simple PDML Parser Written in Java

This repository contains the source code files of a simple PDML parser written in Java.

The parser supports Core PDML, and the following PDML extensions:

There are no dependencies.

Overview

This parser reads input from a standard Java character input stream (file, string, STDIN, Java Reader, etc.) and produces a PDML AST.

The AST can then be explored, modified, or transformed in your application.

Usage example

List the node names in a PDML document:

PdmlParser parser = new PdmlParser();

RootNode rootNode = parser.parseString ( """
    [doc
        text
        [child1 text child 1]
        [child2 text child 2]
    ]""" );

NodeUtils.forEachNodeInTree ( rootNode, node -> {
    if ( node instanceof RootOrBranchNode branchNode ) {
        System.out.println ( branchNode.getName() );
    }
});

Output:

doc
child1
child2

Useful links:

About

Simple PDML parser, written in Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages