addFunction method

void addFunction(
  1. String name,
  2. dynamic handler
)

Registers a function handler with the parser.

This can be used to define custom functions that run native Dart code.

Implementation

void addFunction(String name, dynamic handler) {
  if (lex.keywords.containsKey(name)) {
    throw FormatException('Cannot redefine existing function $name');
  }
  lex.keywords[name] = TokenType.FUNC;
  functionHandlers[name] = handler;
}