HighlightSymbolTableBuilder { public static void build(NewSymbolTable newSymbolTable, TreeVisitorContext context) { for (Symbol symbol : context.getSymbolModel().getSymbols()) { highlightSymbol(newSymbolTable, symbol); } newSymbolTable.save(); } private  HighlightSymbolTableBuilder(); static void build(NewSymbolTable newSymbolTable, TreeVisitorContext context);  }
@Test public void sonar_symbol_table() throws Exception { String filename = "symbolHighlighting.esql"; String key = "moduleKey:" + filename; HighlightSymbolTableBuilder.build(newSymbolTable(filename), context(inputFile)); assertThat(references(key, 2, 11)).containsOnly(textRange(3, 7, 8), textRange(4, 7, 8)); assertThat(references(key, 1, 16)).containsOnly(textRange(3, 11, 12)); assertThat(references(key, 14, 26)).containsOnly(textRange(15, 19, 20)); }
@Test public void byte_order_mark_should_not_increment_offset() throws Exception { String filename = "symbolHighlightingBom.esql"; HighlightSymbolTableBuilder.build(newSymbolTable(filename), context(inputFile)); assertThat(Files.toString(inputFile.file(), inputFile.charset()).startsWith("\uFEFF")).isTrue(); assertThat(references("moduleKey:" + filename, 1, 16)).containsOnly(textRange(2, 11, 12)); }