From 028b58adc4b4006800f2f8624ded86e11ed06a37 Mon Sep 17 00:00:00 2001 From: moculus Date: Thu, 14 Jun 2007 14:14:08 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- lex2_python.py | 18 ++++++++++-------- mode_python.py | 10 +++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lex2_python.py b/lex2_python.py index 63486fa..48bd203 100755 --- a/lex2_python.py +++ b/lex2_python.py @@ -19,15 +19,11 @@ class StringGrammar(Grammar): class PythonGrammar(Grammar): rules = [ PatternRule( - name=r'import', - pattern=r'(?:^|(?<= ))import(?= |$)', - ), - PatternRule( - name=r'methodname', + name=r'functiondef', pattern=r'(?<=def )[a-zA-Z_][a-zA-Z0-9_]*', ), PatternRule( - name=r'classname', + name=r'classdef', pattern=r'(?<=class )[a-zA-Z_][a-zA-Z0-9_]*', ), PatternRule( @@ -39,13 +35,18 @@ class PythonGrammar(Grammar): pattern=r'(?:yield|while|try|return|raise|print|pass|or|not|lambda|is|in|import|if|global|from|for|finally|exec|except|else|elif|del|def|continue|class|break|assert|as|and)(?![a-zA-Z0-9_])', ), PatternRule( - name=r"builtin_method", + name=r"builtin", pattern=r'(?|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%", ), + PatternRule( name=r"integer", pattern=r"(?