All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.api.batch.sensor.symbol.NewSymbolTable Maven / Gradle / Ivy

There is a newer version: 10.5.0.78949
Show newest version
/*
 * SonarQube
 * Copyright (C) 2009-2021 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package org.sonar.api.batch.sensor.symbol;

import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.TextRange;

/**
 * This builder is used to define symbol references on files.
 * 
 * Example:
 * 
 * 
 *   NewSymbolTable symbolTable = sensorContext.newSymbolTable().onFile(inputFile);
 *   symbolTable.newSymbol(1, 10, 1, 15)
 *     .newReference(10, 12, 10, 17)
 *     .newReference(11, 11, 11, 16);
 *     
 *   // Add more symbols if needed
 *     
 *   symbolTable.save();
 *     
 * 
* * @since 5.6 */ public interface NewSymbolTable { /** * The file the symbol table belongs to. */ NewSymbolTable onFile(InputFile inputFile); /** * Register a new symbol declaration. * @param range Range of text for the symbol declaration. See for example {@link InputFile#newRange(int, int, int, int)}. */ NewSymbol newSymbol(TextRange range); /** * Shortcut to avoid calling {@link InputFile#newRange(int, int, int, int)} */ NewSymbol newSymbol(int startLine, int startLineOffset, int endLine, int endLineOffset); /** * Call this method only once when your are done with defining all symbols of the file. It is not permitted to save a symbol table twice for the same file. * @throws IllegalStateException if you have defined overlapping symbols */ void save(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy