parse method

dynamic parse(
  1. dynamic code
)

Implementation

parse(code) {
  var keywordNames = this.keywords;

  var regExp = RegExp(r"\\b${keywordNames.join( '\\b|\\b' )}\\b",
      caseSensitive: false);

  var codeKeywords = code.match(regExp);

  var keywordNodes = [];

  if (codeKeywords != null) {
    for (var keyword in codeKeywords) {
      var node = this.getNode(keyword);

      if (node != undefined && keywordNodes.indexOf(node) == -1) {
        keywordNodes.add(node);
      }
    }
  }

  return keywordNodes;
}