[Mumps2Py:] [155] tweaks to support token-colorizing.

[ Thread Index | Date Index | More lists.mumps2py.org/discuss Archives ]


Revision: 155
Author:   pgallot
Date:     2008-03-04 17:58:41 +0000 (Tue, 04 Mar 2008)

Log Message:
-----------
tweaks to support token-colorizing.

Modified Paths:
--------------
    trunk/mumps2py/mumps2tok.py


Modified: trunk/mumps2py/mumps2tok.py
===================================================================
--- trunk/mumps2py/mumps2tok.py	2008-03-03 23:09:35 UTC (rev 154)
+++ trunk/mumps2py/mumps2tok.py	2008-03-04 17:58:41 UTC (rev 155)
@@ -92,6 +92,7 @@
 def parse_entry_ref(line, pos):
     """ parses a Mumps Entry Ref"""
     token = Token(ENTRYREF, pos)
+    token.end = None
     if line[pos] == '@':
         if MUMPS_RE_DICT["nakedRef"].match(line, pos + 1):
             indirect = parse_expr(line, pos+1, r"([,+: ]|\s$)")
@@ -129,10 +130,12 @@
             else:
                 token.routine = m_name.group()
                 pos = m_name.end()
+            token.end = pos
         if not MUMPS_RE_DICT["cmdEnd"].match(line, pos) and line[pos] == '(':
             pos, token.params = consume_actuallist(line, pos + 1)
     
-    token.end = pos
+    if not token.end:
+        token.end = pos
     return (token, pos)
 
 def parse_emptyline(line, startpos = 0):
@@ -944,6 +947,9 @@
 
     toktype = CMD_TOKEN_DICT.get(cmd, UNKNOWNCMD)
     cmd_token = Token(toktype, startpos)
+    cmd_token.cmd_start = re_match.start("cmd")
+    cmd_token.cmd_end = re_match.end("cmd")
+
     if toktype == UNKNOWNCMD:
         cmd_token.name = cmd
     if re_match.group("indents"): # count the periods for the nesting level...


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/