¡@

Home 

python Programming Glossary: tok

Simple regex-based lexer in Python

http://stackoverflow.com/questions/133886/simple-regex-based-lexer-in-python

class Token object A simple Token structure. Contains the token type value and position. def __init__ self type val pos self.type.. self.pos pos class Lexer object A simple regex based lexer tokenizer. See below for an example of usage. def __init__ self.. `regex` is the regular expression used to recognize the token and `type` is the type of the token to return when it's recognized...

Python: How best to parse a simple grammar?

http://stackoverflow.com/questions/2945357/python-how-best-to-parse-a-simple-grammar

how that is best done. def addCourse self str location tokens self.result.append tokens 0 0 tokens 0 1 def makeCourseList.. def addCourse self str location tokens self.result.append tokens 0 0 tokens 0 1 def makeCourseList self str location tokens.. self str location tokens self.result.append tokens 0 0 tokens 0 1 def makeCourseList self str location tokens dept tokens..