File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -479,7 +479,7 @@ func (c *cc) VisitObject_feature_value(n *parser.Object_feature_valueContext) in
479479		return  bindPar 
480480
481481	case  n .STRING_VALUE () !=  nil :
482- 		value , _  :=  parseStringValue (n .STRING_VALUE ().GetText ())
482+ 		value , _  :=  parseStringLiteral (n .STRING_VALUE ().GetText ())
483483		return  & ast.A_Const {Val : NewIdentifier (value ), Location : c .pos (n .GetStart ())}
484484
485485	case  n .Bool_value () !=  nil :
@@ -3728,13 +3728,9 @@ func (c *cc) VisitLiteral_value(n *parser.Literal_valueContext) interface{} {
37283728
37293729	case  n .STRING_VALUE () !=  nil : // !!! debug !!! (problem with quoted strings) 
37303730		originalText  :=  n .STRING_VALUE ().GetText ()
3731- 		content , hasSuffix  :=  parseStringValue (originalText )
3731+ 		content , _  :=  parseStringLiteral (originalText )
37323732
3733- 		if  hasSuffix  {
3734- 			return  & ast.A_Const {Val : & ast.String {Str : originalText }, Location : c .pos (n .GetStart ())}
3735- 		} else  {
3736- 			return  & ast.A_Const {Val : & ast.String {Str : content }, Location : c .pos (n .GetStart ())}
3737- 		}
3733+ 		return  & ast.A_Const {Val : & ast.String {Str : content }, Location : c .pos (n .GetStart ())}
37383734
37393735	case  n .Bool_value () !=  nil :
37403736		var  i  bool 
Original file line number Diff line number Diff line change @@ -296,8 +296,10 @@ func (c *cc) collectEqualityOps(ctx parser.ICond_exprContext) []antlr.TerminalNo
296296	return  ops 
297297}
298298
299- 
300- func  parseStringValue (s  string ) (value  string , hasSuffix  bool ) {
299+ // parseStringLiteral parses a string literal from a YQL query and returns the value and whether it has a suffix. 
300+ // If a valid suffix is found, it is stripped and the content is returned. 
301+ // FIXME: rewrite this logic to correctly handle the type based on the suffix. 
302+ func  parseStringLiteral (s  string ) (value  string , hasSuffix  bool ) {
301303	if  len (s ) <  2  {
302304		return  s , false 
303305	}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments