SyntaxHighlighterVisitor extends PHPVisitorCheck { public static void highlight(Tree tree, NewHighlighting highlighting) { SyntaxHighlighterVisitor visitor = new SyntaxHighlighterVisitor(highlighting); visitor.scan(tree); } private  SyntaxHighlighterVisitor(NewHighlighting highlighting); static void highlight(Tree tree, NewHighlighting highlighting); @Override void visitToken(SyntaxToken token); @Override void visitTrivia(SyntaxTrivia trivia); @Override void visitExpandableStringLiteral(ExpandableStringLiteralTree tree); @Override void visitLiteral(LiteralTree tree); @Override void visitExpandableStringCharacters(ExpandableStringCharactersTree tree);  }
@Test public void empty_input() throws Exception { highlight("<?php "); assertThat(context.highlightingTypeAt(componentKey(), 1, 0)).isEmpty(); }
@Test public void single_line_comment() throws Exception { highlight("<?php checkOnRange(1, 8, 10, TypeOfText.COMMENT); }
@Test public void multiline_comment_on_one_line() throws Exception { highlight("<?php "); checkOnRange(1, 8, 11, TypeOfText.COMMENT); }
@Test public void multiline_comment_on_three_lines() throws Exception { highlight("<?php "); check(1, 7, null); check(1, 8, TypeOfText.COMMENT); check(1, 23, TypeOfText.COMMENT); check(2, 0, TypeOfText.COMMENT); check(2, 5, TypeOfText.COMMENT); check(2, 5, TypeOfText.COMMENT); check(3, 0, TypeOfText.COMMENT); check(3, 17, TypeOfText.COMMENT); check(3, 18, null); }
@Test public void shell_style_comment() throws Exception { highlight("<?php #Comment "); checkOnRange(1, 8, 9, TypeOfText.COMMENT); }
@Test public void phpdoc_comment() throws Exception { highlight("<?php "); checkOnRange(1, 8, 12, TypeOfText.STRUCTURED_COMMENT); }
@Test public void keyword() throws Exception { highlight("<?php eval(\"1\");"); checkOnRange(1, 6, 4, TypeOfText.KEYWORD); checkOnRange(1, 11, 3, TypeOfText.STRING); }
@Test public void php_reserved_variables() throws Exception { highlight("<?php $a = $this; $b = __LINE__;"); checkOnRange(1, 11, 5, TypeOfText.KEYWORD); checkOnRange(1, 23, 8, TypeOfText.KEYWORD); }
@Test public void string() throws Exception { highlight("<?php $x = \"a\";"); checkOnRange(1, 11, 3, TypeOfText.STRING); }
@Test public void expandable_string() throws Exception { highlight("<?php \"Hello $name!\";"); checkOnRange(1, 6, 7, TypeOfText.STRING); checkOnRange(1, 18, 2, TypeOfText.STRING); }
@Test public void numbers() throws Exception { highlight("<?php $x = 1; $y = 1.0;"); checkOnRange(1, 11, 1, TypeOfText.CONSTANT); checkOnRange(1, 19, 3, TypeOfText.CONSTANT); }