mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-27 14:02:07 +00:00 
			
		
		
		
	 38f6140159
			
		
	
	
		38f6140159
		
	
	
	
	
		
			
			This works at the Token level, which is quick and easy but has drawbacks: We don't know when something is a property name or a value, or if something is part of a selector. But, this works for now.
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			747 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			747 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibSyntax/Highlighter.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| class SyntaxHighlighter : public Syntax::Highlighter {
 | |
| public:
 | |
|     SyntaxHighlighter() = default;
 | |
|     virtual ~SyntaxHighlighter() override = default;
 | |
| 
 | |
|     virtual bool is_identifier(u64) const override;
 | |
|     virtual bool is_navigatable(u64) const override;
 | |
| 
 | |
|     virtual Syntax::Language language() const override { return Syntax::Language::CSS; }
 | |
|     virtual void rehighlight(Palette const&) override;
 | |
| 
 | |
| protected:
 | |
|     virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override;
 | |
|     virtual bool token_types_equal(u64, u64) const override;
 | |
| };
 | |
| 
 | |
| }
 |