mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:52:45 +00:00 
			
		
		
		
	 97a333608e
			
		
	
	
		97a333608e
		
	
	
	
	
		
			
			Just a little thinking outside the box, and we can now parse and optimise a million copies of "a|" chained together in just a second :^)
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			497 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			497 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "Forward.h"
 | |
| #include <AK/Vector.h>
 | |
| 
 | |
| namespace regex {
 | |
| 
 | |
| class Optimizer {
 | |
| public:
 | |
|     static void append_alternation(ByteCode& target, ByteCode&& left, ByteCode&& right);
 | |
|     static void append_alternation(ByteCode& target, Span<ByteCode> alternatives);
 | |
|     static void append_character_class(ByteCode& target, Vector<CompareTypeAndValuePair>&& pairs);
 | |
| };
 | |
| 
 | |
| }
 |