diff options
| author | Cengiz Kaygusuz <cngkaygusuz@gmail.com> | 2017-11-20 20:46:39 -0500 |
|---|---|---|
| committer | Cengiz Kaygusuz <cngkaygusuz@gmail.com> | 2017-11-20 20:46:39 -0500 |
| commit | 27e183a78c8062ed7c2bbb91655a5e56cd697bba (patch) | |
| tree | 88fd355a0cc6da4c130582e092d702836596cbb2 /examples/greetingInGreek.py | |
| parent | 4ba589cf13588e90992e23deb5a9784340efd2cc (diff) | |
| download | pyparsing-git-27e183a78c8062ed7c2bbb91655a5e56cd697bba.tar.gz | |
Move src to root
Diffstat (limited to 'examples/greetingInGreek.py')
| -rw-r--r-- | examples/greetingInGreek.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/greetingInGreek.py b/examples/greetingInGreek.py new file mode 100644 index 0000000..c4d002f --- /dev/null +++ b/examples/greetingInGreek.py @@ -0,0 +1,20 @@ +# vim:fileencoding=utf-8
+#
+# greetingInGreek.py
+#
+# Demonstration of the parsing module, on the prototypical "Hello, World!" example
+#
+# Copyright 2004-2016, by Paul McGuire
+#
+from pyparsing import Word
+
+# define grammar
+alphas = ''.join(chr(x) for x in range(0x386, 0x3ce))
+greet = Word(alphas) + ',' + Word(alphas) + '!'
+
+# input string
+hello = "Καλημέρα, κόσμε!".decode('utf-8')
+
+# parse input string
+print(greet.parseString( hello ))
+
|
