Hetu constructor

Hetu({
  1. HetuConfig? config,
  2. HTResourceContext<HTSource>? sourceContext,
  3. HTLexicon? lexicon,
  4. String parserName = 'default',
  5. HTParser? parser,
})

Create a Hetu environment.

Implementation

Hetu(
    {HetuConfig? config,
    HTResourceContext<HTSource>? sourceContext,
    HTLexicon? lexicon,
    String parserName = 'default',
    HTParser? parser})
    : config = config ?? HetuConfig(),
      lexicon = lexicon ?? HTDefaultLexicon(),
      sourceContext = sourceContext ?? HTOverlayContext() {
  _currentParser = parser ??
      HTDefaultParser(
        config: this.config,
      );
  bundler = HTBundler(
    sourceContext: this.sourceContext,
  );
  _parsers[parserName] = _currentParser;
  analyzer = HTAnalyzer(
    config: this.config,
    sourceContext: this.sourceContext,
  );
  compiler = HTCompiler(
    config: this.config,
    lexicon: this.lexicon,
  );
  interpreter = HTInterpreter(
    config: this.config,
    sourceContext: this.sourceContext,
    lexicon: this.lexicon,
  );
}