Example #1
0
def t_ID(t):
	r'[A-Za-z_][\w]*'
	## problens len 1
	t.type = reserved_map.get(t.value.upper(),'ID')
	if t.type == 'ID':
		symtab.attach_symbol(t)
	return t
Example #2
0
def t_ID(t):
    r'[A-Za-z_][\w]*'
    ## problens len 1
    t.type = reserved_map.get(t.value.upper(), 'ID')
    if t.type == 'ID':
        symtab.attach_symbol(t)
    return t
def t_ID(t):
    r'[a-zA-Z_][a-zA-Z0-9_]*'
    if t.value.upper() in keywords:
        t.type = t.value.upper()
    # Agrega el ID a la tabla de simbolos
    else: 
        t.type = 'ID'
        symtab.attach_symbol(t)
    return t