Class DockerNodeBuilder

  • All Implemented Interfaces:
    com.sonar.sslr.api.typed.NodeBuilder

    public class DockerNodeBuilder
    extends Object
    implements com.sonar.sslr.api.typed.NodeBuilder
    • Constructor Detail

      • DockerNodeBuilder

        public DockerNodeBuilder()
    • Method Detail

      • createNonTerminal

        public Object createNonTerminal​(org.sonar.sslr.grammar.GrammarRuleKey ruleKey,
                                        com.sonar.sslr.api.Rule rule,
                                        List<Object> children,
                                        int startIndex,
                                        int endIndex)
        Specified by:
        createNonTerminal in interface com.sonar.sslr.api.typed.NodeBuilder
      • createTerminal

        public Object createTerminal​(com.sonar.sslr.api.typed.Input input,
                                     int startIndex,
                                     int endIndex,
                                     List<com.sonar.sslr.api.Trivia> trivias,
                                     com.sonar.sslr.api.TokenType type)
        Specified by:
        createTerminal in interface com.sonar.sslr.api.typed.NodeBuilder
      • tokenRange

        protected TextRange tokenRange​(com.sonar.sslr.api.typed.Input input,
                                       int startIndex,
                                       String value)
        Compute the TextRange from a value at the given startIndex, regarding the provided input (source code). In case it extend to multiple lines, we build a CompoundTextRange object with a reference to each line TextRange. It is used to track back tokens in HereDoc, as currently the full HereDoc content of an instruction is considered as a single SyntaxToken that extend to multiple lines, which is then parsed by a specific HereDoc parser. This is this parser that call this tokenRange(Input, int, String) method to split this big SyntaxToken into multiple SyntaxToken, each with its own range.
        The startIndex is the position on the instruction line where the provided value begin. In the line RUN <<EOT cmd ..., the startIndex would be 4 (to skip the RUN part) and the value would be the HereDoc content: <<EOT cmd ...
      • setPreprocessorResult

        public void setPreprocessorResult​(org.sonar.iac.docker.parser.DockerPreprocessor.PreprocessorResult preprocessorResult)