[refactoring] allow nil parser.errHandlerFunc
This commit is contained in:
		
							parent
							
								
									476e84229d
								
							
						
					
					
						commit
						84fe08869d
					
				| @ -36,6 +36,10 @@ func (p *Parser) Lex(lval *yySymType) int { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (p *Parser) Error(msg string) { | func (p *Parser) Error(msg string) { | ||||||
|  | 	if p.errHandlerFunc == nil { | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	var pos = p.currentToken.Position | 	var pos = p.currentToken.Position | ||||||
| 	p.errHandlerFunc(errors.NewError(msg, &pos)) | 	p.errHandlerFunc(errors.NewError(msg, &pos)) | ||||||
| } | } | ||||||
|  | |||||||
| @ -35,6 +35,10 @@ func (p *Parser) Lex(lval *yySymType) int { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (p *Parser) Error(msg string) { | func (p *Parser) Error(msg string) { | ||||||
|  | 	if p.errHandlerFunc == nil { | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	var pos = p.currentToken.Position | 	var pos = p.currentToken.Position | ||||||
| 	p.errHandlerFunc(errors.NewError(msg, &pos)) | 	p.errHandlerFunc(errors.NewError(msg, &pos)) | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user