In the case of php only code enclosed get parsed, ignore other characters before or after it.
Assume we have the following:
LEX
t_OPEN= r'\<\?php'
t_CLOSE = r'\?\>'
YACC
'''program : OPEN statements CLOSE'''
if the input looks like below, it will generate an error
randomstring <?php echo 1 ?>
I tried tokens use regex to capture not enclosed text, did not work. is there any way to do this?
def t_RANDOM(t) :
r'(.*)\<\?'
pass