Hello Dennis,
Thanks a lot, it works quite well !
So for anyone like me ;-) who would not have read enough the nice
documentation I post the lines I did change from the code example that
I gave above :
#-------------------------------------------------------------------------------
reserved = {
'END' : 'END',
'HOST' : 'HOST',
'HOSTNAMES' : 'HOSTNAMES',
'PLUS' : 'PLUS'
}
tokens = [ 'CONTROL_STR','NAME','NUMBER', ] + list(reserved.values())
#t_END = 'END'
#t_HOST = 'HOST'
#t_HOSTNAMES = 'HOSTNAMES'
#t_PLUS = 'PLUS'
#t_NAME = r'[a-zA-Z_][a-zA-Z0-9_]*'
def t_NAME(t):
r'[a-zA-Z_][a-zA-Z_0-9]*'
t.type = reserved.get(t.value,'NAME') # Check for reserved
words
return t
#precedence = (
# ('left', 'NAME'),
# ('left','END','HOST','HOSTNAMES','NUMBER','PLUS'),
# ('left', 'CONTROL_STR'),
# )
#-------------------------------------------------------------------------------
Thank you :)
clousot (Patrice)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ply-hack" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---