mirror of
				https://github.com/taigrr/yq
				synced 2025-01-18 04:53:17 -08:00 
			
		
		
		
	Dont use pointer for commment prefs (avoid nil)
This commit is contained in:
		
							parent
							
								
									91c72d2d9e
								
							
						
					
					
						commit
						0484d0232b
					
				| @ -125,7 +125,7 @@ func assignAllCommentsOp(updateAssign bool) lex.Action { | ||||
| 			Value:         assignCommentOpType.Type, | ||||
| 			StringValue:   value, | ||||
| 			UpdateAssign:  updateAssign, | ||||
| 			Preferences:   &commentOpPreferences{LineComment: true, HeadComment: true, FootComment: true}, | ||||
| 			Preferences:   commentOpPreferences{LineComment: true, HeadComment: true, FootComment: true}, | ||||
| 		} | ||||
| 		return &token{TokenType: operationToken, Operation: op}, nil | ||||
| 	} | ||||
| @ -252,11 +252,11 @@ func initLexer() (*lex.Lexer, error) { | ||||
| 	lexer.Add([]byte(`fi`), opToken(getFileIndexOpType)) | ||||
| 	lexer.Add([]byte(`path`), opToken(getPathOpType)) | ||||
| 
 | ||||
| 	lexer.Add([]byte(`lineComment`), opTokenWithPrefs(getCommentOpType, assignCommentOpType, &commentOpPreferences{LineComment: true})) | ||||
| 	lexer.Add([]byte(`lineComment`), opTokenWithPrefs(getCommentOpType, assignCommentOpType, commentOpPreferences{LineComment: true})) | ||||
| 
 | ||||
| 	lexer.Add([]byte(`headComment`), opTokenWithPrefs(getCommentOpType, assignCommentOpType, &commentOpPreferences{HeadComment: true})) | ||||
| 	lexer.Add([]byte(`headComment`), opTokenWithPrefs(getCommentOpType, assignCommentOpType, commentOpPreferences{HeadComment: true})) | ||||
| 
 | ||||
| 	lexer.Add([]byte(`footComment`), opTokenWithPrefs(getCommentOpType, assignCommentOpType, &commentOpPreferences{FootComment: true})) | ||||
| 	lexer.Add([]byte(`footComment`), opTokenWithPrefs(getCommentOpType, assignCommentOpType, commentOpPreferences{FootComment: true})) | ||||
| 
 | ||||
| 	lexer.Add([]byte(`comments\s*=`), assignAllCommentsOp(false)) | ||||
| 	lexer.Add([]byte(`comments\s*\|=`), assignAllCommentsOp(true)) | ||||
|  | ||||
| @ -23,7 +23,7 @@ func assignCommentsOperator(d *dataTreeNavigator, matchingNodes *list.List, expr | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	preferences := expressionNode.Operation.Preferences.(*commentOpPreferences) | ||||
| 	preferences := expressionNode.Operation.Preferences.(commentOpPreferences) | ||||
| 
 | ||||
| 	comment := "" | ||||
| 	if !expressionNode.Operation.UpdateAssign { | ||||
| @ -67,7 +67,7 @@ func assignCommentsOperator(d *dataTreeNavigator, matchingNodes *list.List, expr | ||||
| } | ||||
| 
 | ||||
| func getCommentsOperator(d *dataTreeNavigator, matchingNodes *list.List, expressionNode *ExpressionNode) (*list.List, error) { | ||||
| 	preferences := expressionNode.Operation.Preferences.(*commentOpPreferences) | ||||
| 	preferences := expressionNode.Operation.Preferences.(commentOpPreferences) | ||||
| 	log.Debugf("GetComments operator!") | ||||
| 	var results = list.New() | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user