reference: inline "group()"
It was only used in a couple of places, and more transparent to just inline it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>master
							parent
							
								
									1d4917d4fb
								
							
						
					
					
						commit
						c786a2bd3e
					
				|  | @ -145,18 +145,13 @@ func expression(res ...string) string { | ||||||
| // optional wraps the expression in a non-capturing group and makes the
 | // optional wraps the expression in a non-capturing group and makes the
 | ||||||
| // production optional.
 | // production optional.
 | ||||||
| func optional(res ...string) string { | func optional(res ...string) string { | ||||||
| 	return group(strings.Join(res, "")) + `?` | 	return `(?:` + strings.Join(res, "") + `)?` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // repeated wraps the regexp in a non-capturing group to get one or more
 | // repeated wraps the regexp in a non-capturing group to get one or more
 | ||||||
| // matches.
 | // matches.
 | ||||||
| func repeated(res ...string) string { | func repeated(res ...string) string { | ||||||
| 	return group(strings.Join(res, "")) + `+` | 	return `(?:` + strings.Join(res, "") + `)+` | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // group wraps the regexp in a non-capturing group.
 |  | ||||||
| func group(res ...string) string { |  | ||||||
| 	return `(?:` + strings.Join(res, "") + `)` |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // capture wraps the expression in a capturing group.
 | // capture wraps the expression in a capturing group.
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue