27 lines
		
	
	
		
			380 B
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			380 B
		
	
	
	
		
			Plaintext
		
	
	
	
| grammar t030specialStates;
 | |
| options {
 | |
|   language = Python3;
 | |
| }
 | |
| 
 | |
| @init {
 | |
| self.cond = True
 | |
| }
 | |
| 
 | |
| @members {
 | |
| def recover(self, input, re):
 | |
|     # no error recovery yet, just crash!
 | |
|     raise re
 | |
| }
 | |
| 
 | |
| r
 | |
|     : ( {self.cond}? NAME
 | |
|         | {not self.cond}? NAME WS+ NAME
 | |
|         )
 | |
|         ( WS+ NAME )?
 | |
|         EOF
 | |
|     ;
 | |
| 
 | |
| NAME: ('a'..'z') ('a'..'z' | '0'..'9')+;
 | |
| NUMBER: ('0'..'9')+;
 | |
| WS: ' '+;
 |