summaryrefslogtreecommitdiff
path: root/src/examples/greetingInGreek.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2012-10-02 04:55:56 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2012-10-02 04:55:56 +0000
commita7f9dda0668bfce4fba51df1bf2976b4a93a8bd5 (patch)
tree57ea8bcf2e66532a36c833a7bc57cff9d5d0e4dd /src/examples/greetingInGreek.py
parentf5d2b716ffb57b65660a7ee0bbf04332dfb29620 (diff)
downloadpyparsing-git-a7f9dda0668bfce4fba51df1bf2976b4a93a8bd5.tar.gz
Add example files to SVN
Diffstat (limited to 'src/examples/greetingInGreek.py')
-rw-r--r--src/examples/greetingInGreek.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/examples/greetingInGreek.py b/src/examples/greetingInGreek.py
new file mode 100644
index 0000000..7869b68
--- /dev/null
+++ b/src/examples/greetingInGreek.py
@@ -0,0 +1,18 @@
+# vim:fileencoding=utf-8
+#
+# greetingInGreek.py
+#
+# Demonstration of the parsing module, on the prototypical "Hello, World!" example
+#
+from pyparsing import Word
+
+# define grammar
+alphas = u''.join(unichr(x) for x in xrange(0x386, 0x3ce))
+greet = Word(alphas) + u',' + Word(alphas) + u'!'
+
+# input string
+hello = "Καλημέρα, κόσμε!".decode('utf-8')
+
+# parse input string
+print greet.parseString( hello )
+