Class PythonHighlighter


  • public class PythonHighlighter
    extends PythonVisitor
    Colors Python code. Currently colors:
    • String literals. Examples:
             "hello"
      
             'hello'
      
             """ hello
                 hello again
             """
           
    • Keywords. Example:
             def
           
    • Numbers. Example:
              123
              123L
              123.45
              123.45e-10
              123+88.99J
           
      For a negative number, the "minus" sign is not colored.
    • Comments. Example:
              # some comment
           
    Docstrings are handled (i.e., colored) as structured comments, not as normal string literals. "Attribute docstrings" and "additional docstrings" (see PEP 258) are handled as normal string literals. Reminder: a docstring is a string literal that occurs as the first statement in a module, function, class, or method definition.
    • Constructor Detail

      • PythonHighlighter

        public PythonHighlighter​(org.sonar.api.batch.sensor.SensorContext context,
                                 org.sonar.api.batch.fs.InputFile inputFile)