mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:02:45 +00:00 
			
		
		
		
	CppLexer: Add token types for "++", "--"
This commit is contained in:
		
							parent
							
								
									598b5e4595
								
							
						
					
					
						commit
						c38b8d63f8
					
				
					 2 changed files with 28 additions and 2 deletions
				
			
		|  | @ -394,11 +394,35 @@ Vector<CppToken> CppLexer::lex() | |||
|             continue; | ||||
|         } | ||||
|         if (ch == '+') { | ||||
|             emit_token_equals(CppToken::Type::Plus, CppToken::Type::PlusEquals); | ||||
|             begin_token(); | ||||
|             consume(); | ||||
|             if (peek() == '+') { | ||||
|                 consume(); | ||||
|                 commit_token(CppToken::Type::PlusPlus); | ||||
|                 continue; | ||||
|             } | ||||
|             if (peek() == '=') { | ||||
|                 consume(); | ||||
|                 commit_token(CppToken::Type::PlusEquals); | ||||
|                 continue; | ||||
|             } | ||||
|             commit_token(CppToken::Type::Plus); | ||||
|             continue; | ||||
|         } | ||||
|         if (ch == '-') { | ||||
|             emit_token_equals(CppToken::Type::Minus, CppToken::Type::MinusEquals); | ||||
|             begin_token(); | ||||
|             consume(); | ||||
|             if (peek() == '-') { | ||||
|                 consume(); | ||||
|                 commit_token(CppToken::Type::MinusMinus); | ||||
|                 continue; | ||||
|             } | ||||
|             if (peek() == '=') { | ||||
|                 consume(); | ||||
|                 commit_token(CppToken::Type::MinusEquals); | ||||
|                 continue; | ||||
|             } | ||||
|             commit_token(CppToken::Type::Minus); | ||||
|             continue; | ||||
|         } | ||||
|         if (ch == '*') { | ||||
|  |  | |||
|  | @ -54,8 +54,10 @@ namespace GUI { | |||
|     __TOKEN(LessGreater)           \ | ||||
|     __TOKEN(Comma)                 \ | ||||
|     __TOKEN(Plus)                  \ | ||||
|     __TOKEN(PlusPlus)              \ | ||||
|     __TOKEN(PlusEquals)            \ | ||||
|     __TOKEN(Minus)                 \ | ||||
|     __TOKEN(MinusMinus)            \ | ||||
|     __TOKEN(MinusEquals)           \ | ||||
|     __TOKEN(Asterisk)              \ | ||||
|     __TOKEN(AsteriskEquals)        \ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nico Weber
						Nico Weber