Search in sources :

Example 1 with TomlLexer

use of org.ballerinalang.toml.antlr4.TomlLexer in project ballerina by ballerina-lang.

the class TomlProcessor method parseTomlContent.

/**
 * Generate the proxy object by passing in the toml file.
 *
 * @param stream charstream object containing the content
 * @return proxy object
 */
public static ParseTree parseTomlContent(CharStream stream) {
    TomlLexer lexer = new TomlLexer(stream);
    // Get a list of matched tokens
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    // Pass the tokens to the parser
    TomlParser parser = new TomlParser(tokens);
    return parser.toml();
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) TomlLexer(org.ballerinalang.toml.antlr4.TomlLexer) TomlParser(org.ballerinalang.toml.antlr4.TomlParser)

Example 2 with TomlLexer

use of org.ballerinalang.toml.antlr4.TomlLexer in project ballerina by ballerina-lang.

the class ConfigProcessor method buildParseTree.

private static ParseTree buildParseTree(CharStream configEntriesStream) {
    TomlLexer lexer = new TomlLexer(configEntriesStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    TomlParser parser = new TomlParser(tokenStream);
    return parser.toml();
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) TomlLexer(org.ballerinalang.toml.antlr4.TomlLexer) TomlParser(org.ballerinalang.toml.antlr4.TomlParser)

Aggregations

CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)2 TomlLexer (org.ballerinalang.toml.antlr4.TomlLexer)2 TomlParser (org.ballerinalang.toml.antlr4.TomlParser)2