blob: fc2ae6c3ec41702b37e4093a02365aa665063d8c [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2011, 2020 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.r.core.model.build;
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.internal.r.core.sourcemodel.SyntaxProblemReporter;
import org.eclipse.statet.ltk.ast.core.AstNode;
import org.eclipse.statet.ltk.core.SourceContent;
import org.eclipse.statet.ltk.issues.core.ProblemRequestor;
import org.eclipse.statet.r.core.model.RSourceUnit;
import org.eclipse.statet.r.core.rsource.ast.RAstNode;
@NonNullByDefault
public class RProblemReporter {
private final SyntaxProblemReporter syntaxProblemReporter= new SyntaxProblemReporter();
public RProblemReporter() {
}
public void run(final RSourceUnit su, final SourceContent content,
final RAstNode node, final ProblemRequestor problemRequestor) {
this.syntaxProblemReporter.run(su, content, node, problemRequestor);
}
public void run(final RSourceUnit su, final SourceContent content,
final AstNode node, final ProblemRequestor problemRequestor) {
if (node instanceof RAstNode) {
run(su, content, (RAstNode)node, problemRequestor);
}
else {
final int n= node.getChildCount();
for (int i= 0; i < n; i++) {
final AstNode child= node.getChild(i);
if (child instanceof RAstNode) {
run(su, content, (RAstNode)child, problemRequestor);
}
}
}
}
}