SkipToNewLine() now recognizes strings and character constants
This commit is contained in:
		
							parent
							
								
									9bab5d363c
								
							
						
					
					
						commit
						24a1c0d390
					
				
					 1 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -60,9 +60,20 @@ SkipToNewLine()
 | 
			
		|||
{
 | 
			
		||||
	register int ch;
 | 
			
		||||
	register int garbage = 0;
 | 
			
		||||
	register int delim = 0;
 | 
			
		||||
 | 
			
		||||
	while ((ch = GetChar()) != '\n') {
 | 
			
		||||
		if (ch == '/') {
 | 
			
		||||
		if (delim) {
 | 
			
		||||
			if (ch == '\\') {
 | 
			
		||||
				if (GetChar() == '\n') break;
 | 
			
		||||
			} else if (ch == delim) {
 | 
			
		||||
				delim = 0;
 | 
			
		||||
			}
 | 
			
		||||
			continue;
 | 
			
		||||
		} else if (ch == '\'' || ch == '\"') {
 | 
			
		||||
			delim = ch;
 | 
			
		||||
			garbage = 1;
 | 
			
		||||
		} else if (ch == '/') {
 | 
			
		||||
			if ((ch = GetChar()) == '*' && !InputLevel) {
 | 
			
		||||
				skipcomment();
 | 
			
		||||
				continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -71,6 +82,7 @@ SkipToNewLine()
 | 
			
		|||
		if (!is_wsp(ch))
 | 
			
		||||
			garbage = 1;
 | 
			
		||||
	}
 | 
			
		||||
	if (delim) strict("unclosed opening %c", delim);
 | 
			
		||||
	++LineNumber;
 | 
			
		||||
	return garbage;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue