Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertSyntaxNodeToAstFile ¶
ConvertSyntaxNodeToAstFile converts a given syntax.Node to an equivalent *ast.File. This function is designed to convert shell-like syntax to Go AST. It creates a new Go file named "main" and a function named "main" within it. The shell-like syntax is traversed and each command is converted to a corresponding Go call expression. The converted expressions are added to the "main" function's body.
Parameters: - node: The syntax.Node to convert.
Returns: - An equivalent *ast.File representing the converted shell-like syntax.
func ExtractVarName ¶
ExtractVarName extracts the variable name and remaining string from patterns like $(OUT_DIR) or ${OUT_DIR} or $VAR. It supports both $() and ${} formats, and also handles the simple $VAR format. If the input string does not match any of these formats, it returns an empty string for both the variable name and remaining string.
Parameters: - arg: The input string containing the variable pattern.
Returns: - A string representing the extracted variable name. - A string representing the remaining string after the extracted variable name.
func IsAllowedExtension ¶
func IsExcludedDir ¶
func TrackVariableAssignments ¶
TrackVariableAssignments traverses the given AST node and identifies variable assignments. It returns a map where the keys are variable names and the values are the corresponding assigned values. If a variable is not assigned a value, the value in the map will be an empty string.
Parameters: - node: The AST node to traverse.
Returns: - A map where the keys are variable names and the values are the corresponding assigned values.
Types ¶
This section is empty.