regular_expression_engine

datastore grammar version 99.1

'library': dictionary { [ regexp ]
	'captures': dictionary { [ @ ]
		'next': stategroup = node-switch successor (
			| node = 'yes' { 'next' = successor }
			| none = 'no'
		)
		'pieces': component 'pieces'
	}
	'first': reference = first
}
'match list' {
	'type': stategroup (
		'code point' {
			'value': text
		}
		'code point range' {
			'begin value': text
			'end value': [ - ] text
		}
	)
	'tail': stategroup (
		'list' {
			'tail': component 'match list'
		}
		'none' { }
	)
}
'bracket expression' { [ [, ] ]
	'match type': stategroup (
		'match' { }
		'mismatch' { [ ^ ] }
	)
	'list': component 'match list'
}
'atom' {
	'type': stategroup (
		'bracket expression' {
			'expression': component 'bracket expression'
		}
		'any code point' { [ . ] }
		'code point' {
			'value': text
		}
	)
}
'atom list' {
	'atom': component 'atom'
	'tail': stategroup (
		'list' {
			'tail': component 'atom list'
		}
		'none' { }
	)
}
'piece' {
	'capture': stategroup (
		'yes' { [ (, ) ]
			'atoms': component 'atom list'
		}
		'no' {
			'atom': component 'atom'
		}
	)
	'repeat': stategroup (
		'once' { }
		'wild card' {
			'type': stategroup (
				'optional' { [ ? ] }
				'repeater' {
					'allow no match': stategroup (
						'yes' { [ * ] }
						'no' { [ + ] }
					)
				}
			)
		}
		'bound' { [ {, } ]
			'min': integer
			'type': stategroup (
				'exact' { }
				'range' { [ , ]
					'type': stategroup (
						'unlimited' { }
						'limited' {
							'max': integer
						}
					)
				}
			)
		}
	)
}
'pieces' {
	'piece': component 'piece'
	'tail': stategroup (
		'list' {
			'tail': component 'pieces'
		}
		'none' { }
	)
}