[Mumps2Py:] [2] removed some compound operator token types of type not-operator. |
[ Thread Index |
Date Index
| More lists.mumps2py.org/discuss Archives
]
Revision: 2
Author: pgallot
Date: 2008-01-17 15:50:37 +0000 (Thu, 17 Jan 2008)
Log Message:
-----------
removed some compound operator token types of type not-operator. e.g. A'&B -> not (A and B).
also added an is_not() helper function to Token class, and fixed a typo in is_expr().
Modified Paths:
--------------
trunk/tokens.py
Modified: trunk/tokens.py
===================================================================
--- trunk/tokens.py 2008-01-15 18:54:28 UTC (rev 1)
+++ trunk/tokens.py 2008-01-17 15:50:37 UTC (rev 2)
@@ -40,10 +40,9 @@
OPNOT, OPAND, OPOR = 57, 58, 59 # ',&, !
OPCONCAT, OPGT, OPLT, OPNGT, OPNLT = 60, 61, 62, 63, 64 # _,>,<,'>,'<
OPEQ, OPNEQ = 65, 66 # =, '=
-OPCONTAINS, OPNCONTAINS, OPFOLLOWS, OPNFOLLOWS = 67, 68, 69, 70 # [,'[,],']
-OPSORTS, OPNSORTS, OPPATMATCH, OPINDIRECT = 69, 70, 71, 72 # ]],']], ?, @
-OPPATATOM, OPNAKEDREF = 73, 74
-OPNAND,OPNOR = 75, 76 # '&, '!
+OPCONTAINS, OPFOLLOWS, OPSORTS = 67, 68, 69 # [,], ]]
+OPPATMATCH, OPINDIRECT = 70, 71 # ?, @
+OPPATATOM, OPNAKEDREF = 72, 73
#NOTE: INTRINSIC FUNCs and VARs have token values starting at 100,150 respectively.
F_ASCII, F_CHAR, F_DATA, F_EXTRACT = 100, 101, 102, 103
@@ -68,13 +67,12 @@
"\\":OPFRACDIV, "/":OPINTDIV,
"#": OPMODULO, "'":OPNOT,
"&":OPAND, "!":OPOR,
- "'&":OPNAND, "'!":OPNOR,
">":OPGT, "<":OPLT,
"'>":OPNGT, "'<":OPNLT,
"=":OPEQ, "'=":OPNEQ,
- "[":OPCONTAINS, "'[":OPNCONTAINS,
- "]":OPFOLLOWS, "']":OPNFOLLOWS,
- "]]":OPSORTS, "']]":OPNSORTS,
+ "[":OPCONTAINS,
+ "]":OPFOLLOWS,
+ "]]":OPSORTS,
"?":OPPATMATCH, "@":OPINDIRECT,
"_":OPCONCAT}
@@ -228,11 +226,8 @@
OPEQ:"=",
OPNEQ:"'=",
OPCONTAINS:"[",
- OPNCONTAINS:"'[",
OPFOLLOWS:"]",
- OPNFOLLOWS:"']",
OPSORTS:"]]",
- OPNSORTS:"']]",
OPPATMATCH:"?",
OPINDIRECT:"@",
OPPATATOM:"Pattern Atom",
@@ -277,7 +272,7 @@
EMPTYLINE:"",
FCC_NEWLINE:"!",
FCC_NEWPAGE:"#",
- FCC_MOV:"?",
+ FCC_MOV:"mov",
FCC_CHARVAL:"asc",
}
@@ -381,9 +376,13 @@
"""returns true if the token is a numeric literal"""
return (self.toktype == NUMLITERAL)
+ def is_not(self):
+ """returns true if the token is the not operator"""
+ return (self.toktype == OPNOT)
+
def is_expr(self):
"""returns true if the token is an expression"""
- return (self.toktype == NUMLITERAL)
+ return (self.toktype == EXPR)
def is_unaryop(self):
"""returns true if the token is a unary operator"""