no message
This commit is contained in:
		
							
								
								
									
										77
									
								
								src/code.c
									
									
									
									
									
								
							
							
						
						
									
										77
									
								
								src/code.c
									
									
									
									
									
								
							@@ -410,16 +410,11 @@ static void parse(const char* start, u8* color)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	const char* ptr = start;
 | 
						const char* ptr = start;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// const char* digitStart = NULL;
 | 
					 | 
				
			||||||
	const char* blockCommentStart = NULL;
 | 
						const char* blockCommentStart = NULL;
 | 
				
			||||||
	const char* singleCommentStart = NULL;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static const char Comment = '-';
 | 
					 | 
				
			||||||
	static const char BlockCommentStart[] = "--[[";
 | 
						static const char BlockCommentStart[] = "--[[";
 | 
				
			||||||
	static const char BlockCommentEnd[] = "]]";
 | 
						static const char BlockCommentEnd[] = "]]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	enum{BlockCommentStartSize = sizeof BlockCommentStart - 1};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	while(true)
 | 
						while(true)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		char c = *ptr;
 | 
							char c = *ptr;
 | 
				
			||||||
@@ -428,24 +423,17 @@ static void parse(const char* start, u8* color)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			const char* end = strstr(ptr, BlockCommentEnd);
 | 
								const char* end = strstr(ptr, BlockCommentEnd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if(end)
 | 
								ptr = end ? end + strlen(BlockCommentEnd) : blockCommentStart + strlen(blockCommentStart);
 | 
				
			||||||
			{
 | 
								memset(color + (blockCommentStart - start), getConfig()->theme.code.comment, ptr - blockCommentStart);
 | 
				
			||||||
				ptr = end = end + strlen(BlockCommentEnd);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				ptr = end = blockCommentStart + strlen(blockCommentStart);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			memset(color + (blockCommentStart - start), getConfig()->theme.code.comment, end - blockCommentStart);
 | 
					 | 
				
			||||||
			blockCommentStart = NULL;
 | 
								blockCommentStart = NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if(c == BlockCommentStart[0] && memcmp(ptr, BlockCommentStart, BlockCommentStartSize) == 0)
 | 
								s32 blockCommentStartSize = strlen(BlockCommentStart);
 | 
				
			||||||
 | 
								if(c == BlockCommentStart[0] && memcmp(ptr, BlockCommentStart, blockCommentStartSize) == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				blockCommentStart = ptr;
 | 
									blockCommentStart = ptr;
 | 
				
			||||||
				ptr += BlockCommentStartSize;
 | 
									ptr += blockCommentStartSize;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
@@ -454,36 +442,39 @@ static void parse(const char* start, u8* color)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(singleCommentStart)
 | 
							// static const char Comment = '-';
 | 
				
			||||||
		{
 | 
							// const char* singleCommentStart = NULL;
 | 
				
			||||||
			if(is_lineend(c))
 | 
							// if(singleCommentStart)
 | 
				
			||||||
			{
 | 
							// {
 | 
				
			||||||
				memset(color + (singleCommentStart - start), getConfig()->theme.code.comment, ptr - singleCommentStart);
 | 
							// 	if(is_lineend(c))
 | 
				
			||||||
				singleCommentStart = NULL;
 | 
							// 	{
 | 
				
			||||||
			}
 | 
							// 		memset(color + (singleCommentStart - start), getConfig()->theme.code.comment, ptr - singleCommentStart);
 | 
				
			||||||
		}
 | 
							// 		singleCommentStart = NULL;
 | 
				
			||||||
		else
 | 
							// 	}
 | 
				
			||||||
		{
 | 
							// }
 | 
				
			||||||
			if(c == Comment && ptr > start && *(ptr-1) == Comment)
 | 
							// else
 | 
				
			||||||
			{
 | 
							// {
 | 
				
			||||||
				singleCommentStart = ptr-1;
 | 
							// 	if(c == Comment && ptr > start && *(ptr-1) == Comment)
 | 
				
			||||||
			}
 | 
							// 	{
 | 
				
			||||||
			else
 | 
							// 		singleCommentStart = ptr-1;
 | 
				
			||||||
			{
 | 
							// 	}
 | 
				
			||||||
 | 
							// 	else
 | 
				
			||||||
 | 
							// 	{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// if(!isprint(c))
 | 
							// 		// if(!isprint(c))
 | 
				
			||||||
				// {
 | 
							// 		// {
 | 
				
			||||||
				// 	digitStart = NULL;
 | 
							// 		// 	digitStart = NULL;
 | 
				
			||||||
				// 	ptr++;
 | 
							// 		// 	ptr++;
 | 
				
			||||||
				// 	continue;
 | 
							// 		// 	continue;
 | 
				
			||||||
				// }
 | 
							// 		// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			}
 | 
							// 	}
 | 
				
			||||||
		}
 | 
							// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(!c) break;
 | 
							if(!c) break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		bool digit = false;
 | 
							// const char* digitStart = NULL;
 | 
				
			||||||
 | 
							// bool digit = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// if(digitStart)
 | 
							// if(digitStart)
 | 
				
			||||||
		// {
 | 
							// {
 | 
				
			||||||
@@ -517,7 +508,7 @@ static void parse(const char* start, u8* color)
 | 
				
			|||||||
		// 	}
 | 
							// 	}
 | 
				
			||||||
		// }
 | 
							// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(digit) color[ptr - start] = getConfig()->theme.code.number;
 | 
							// if(digit) color[ptr - start] = getConfig()->theme.code.number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ptr++;
 | 
							ptr++;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user