mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-17 06:20:27 +00:00
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@5 e7d03fd6-7b0d-0410-9947-9c21f3af8025
15 lines
390 B
Python
15 lines
390 B
Python
import Lexer, re, string
|
|
|
|
def idfunc(m):
|
|
return int(m.group(0))
|
|
|
|
class mathlex(Lexer.Lexer):
|
|
def __init__(self):
|
|
Lexer.Lexer.__init__(self)
|
|
self.addpat(r"([1-9]([0-9]+)?)|0", "ID", idfunc)
|
|
self.addpat(r"\+", "PLUS")
|
|
self.addpat(r"\*","TIMES")
|
|
self.addpat(r"\(", "LPAREN")
|
|
self.addpat(r"\)", "RPAREN")
|
|
self.addpat(r"\s+", "", None, Lexer.SKIPTOK)
|
|
|