/*
 * Copyright 2000-2014 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.lang;

import com.intellij.util.CharTable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * Abstract syntax tree built up from light nodes.
 */
public abstract class LighterAST {
  private final CharTable myCharTable;

  public LighterAST(@NotNull CharTable charTable) {
    myCharTable = charTable;
  }

  @NotNull
  public CharTable getCharTable() {
    return myCharTable;
  }

  @NotNull
  public abstract LighterASTNode getRoot();

  @Nullable
  public abstract LighterASTNode getParent(@NotNull final LighterASTNode node);

  @NotNull
  public abstract List<LighterASTNode> getChildren(@NotNull final LighterASTNode parent);

  public abstract void disposeChildren(@NotNull List<LighterASTNode> children);
}
@@ -646,22 +646,199 @@
 lij.
-util.CharTable
+openapi.util.Condition;%0Aimport com.intellij.psi.tree.IElementType;%0Aimport com.intellij.psi.tree.TokenSet;%0Aimport com.intellij.util.CharTable;%0Aimport com.intellij.util.containers.ContainerUtil
 ;%0Aim
@@ -1492,16 +1492,16 @@
 rent);%0A%0A
-
   public
@@ -1571,10 +1571,725 @@
 ildren);
+%0A%0A  @Nullable%0A  public LighterASTNode findChildByType(@Nullable LighterASTNode node, @NotNull final IElementType type) %7B%0A    if (node == null) return null;%0A    return ContainerUtil.find(getChildren(node), new Condition%3CLighterASTNode%3E() %7B%0A      @Override%0A      public boolean value(LighterASTNode node) %7B%0A        return node.getTokenType() == type;%0A      %7D%0A    %7D);%0A  %7D%0A%0A  @NotNull%0A  public List%3CLighterASTNode%3E findChildrenByType(@NotNull LighterASTNode node, @NotNull final TokenSet types) %7B%0A    return ContainerUtil.filter(getChildren(node), new Condition%3CLighterASTNode%3E() %7B%0A      @Override%0A      public boolean value(LighterASTNode node) %7B%0A        return types.contains(node.getTokenType());%0A      %7D%0A    %7D);%0A  %7D
 %0A%7D

add some helper methods to LighterAST