diff options
Diffstat (limited to 'trunk/src/examples/matchPreviousDemo.py')
-rw-r--r-- | trunk/src/examples/matchPreviousDemo.py | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/trunk/src/examples/matchPreviousDemo.py b/trunk/src/examples/matchPreviousDemo.py deleted file mode 100644 index f0812e9..0000000 --- a/trunk/src/examples/matchPreviousDemo.py +++ /dev/null @@ -1,33 +0,0 @@ -#
-# matchPreviousDemo.py
-#
-
-from pyparsing import *
-
-src = """
-class a
-...
-end a;
-
-class b
-...
-end b;
-
-class c
-...
-end d;"""
-
-
-identifier = Word(alphas)
-
-classIdent = identifier("classname") # note that this also makes a copy of identifier
-classHead = "class" + classIdent
-classBody = "..."
-classEnd = "end" + matchPreviousLiteral(classIdent) + ';'
-classDefn = classHead + classBody + classEnd
-
-# use this form to catch syntax error
-# classDefn = classHead + classBody - classEnd
-
-for tokens in classDefn.searchString(src):
- print(tokens.classname)
\ No newline at end of file |