Package org.sonar.iac.docker.parser
Class DockerNodeBuilder
- java.lang.Object
-
- org.sonar.iac.docker.parser.DockerNodeBuilder
-
- All Implemented Interfaces:
com.sonar.sslr.api.typed.NodeBuilder
public class DockerNodeBuilder extends Object implements com.sonar.sslr.api.typed.NodeBuilder
-
-
Field Summary
Fields Modifier and Type Field Description static charBYTE_ORDER_MARK
-
Constructor Summary
Constructors Constructor Description DockerNodeBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectcreateNonTerminal(org.sonar.sslr.grammar.GrammarRuleKey ruleKey, com.sonar.sslr.api.Rule rule, List<Object> children, int startIndex, int endIndex)ObjectcreateTerminal(com.sonar.sslr.api.typed.Input input, int startIndex, int endIndex, List<com.sonar.sslr.api.Trivia> trivias, com.sonar.sslr.api.TokenType type)voidsetPreprocessorResult(org.sonar.iac.docker.parser.DockerPreprocessor.PreprocessorResult preprocessorResult)protected TextRangetokenRange(com.sonar.sslr.api.typed.Input input, int startIndex, String value)Compute theTextRangefrom a value at the givenstartIndex, regarding the providedinput(source code).
-
-
-
Field Detail
-
BYTE_ORDER_MARK
public static final char BYTE_ORDER_MARK
- See Also:
- Constant Field Values
-
-
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:
createNonTerminalin interfacecom.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:
createTerminalin interfacecom.sonar.sslr.api.typed.NodeBuilder
-
tokenRange
protected TextRange tokenRange(com.sonar.sslr.api.typed.Input input, int startIndex, String value)
Compute theTextRangefrom a value at the givenstartIndex, regarding the providedinput(source code). In case it extend to multiple lines, we build aCompoundTextRangeobject with a reference to each lineTextRange. It is used to track back tokens in HereDoc, as currently the full HereDoc content of an instruction is considered as a singleSyntaxTokenthat extend to multiple lines, which is then parsed by a specific HereDoc parser. This is this parser that call thistokenRange(Input, int, String)method to split this bigSyntaxTokeninto multipleSyntaxToken, each with its own range.
ThestartIndexis the position on the instruction line where the provided value begin. In the lineRUN <<EOT cmd ..., thestartIndexwould be 4 (to skip theRUNpart) and the value would be the HereDoc content:<<EOT cmd ...
-
setPreprocessorResult
public void setPreprocessorResult(org.sonar.iac.docker.parser.DockerPreprocessor.PreprocessorResult preprocessorResult)
-
-