summaryrefslogtreecommitdiff
path: root/examples/greetingInKorean.py
diff options
context:
space:
mode:
authorCengiz Kaygusuz <cngkaygusuz@gmail.com>2017-11-20 20:46:39 -0500
committerCengiz Kaygusuz <cngkaygusuz@gmail.com>2017-11-20 20:46:39 -0500
commit27e183a78c8062ed7c2bbb91655a5e56cd697bba (patch)
tree88fd355a0cc6da4c130582e092d702836596cbb2 /examples/greetingInKorean.py
parent4ba589cf13588e90992e23deb5a9784340efd2cc (diff)
downloadpyparsing-git-27e183a78c8062ed7c2bbb91655a5e56cd697bba.tar.gz
Move src to root
Diffstat (limited to 'examples/greetingInKorean.py')
-rw-r--r--examples/greetingInKorean.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/greetingInKorean.py b/examples/greetingInKorean.py
new file mode 100644
index 0000000..e48cc8b
--- /dev/null
+++ b/examples/greetingInKorean.py
@@ -0,0 +1,22 @@
+# vim:fileencoding=utf-8
+#
+# greetingInKorean.py
+#
+# Demonstration of the parsing module, on the prototypical "Hello, World!" example
+#
+# Copyright 2004-2016, by Paul McGuire
+#
+from pyparsing import Word, srange
+
+koreanChars = srange(r"[\0xac00-\0xd7a3]")
+koreanWord = Word(koreanChars,min=2)
+
+# define grammar
+greet = koreanWord + "," + koreanWord + "!"
+
+# input string
+hello = '\uc548\ub155, \uc5ec\ub7ec\ubd84!' #"Hello, World!" in Korean
+
+# parse input string
+print(greet.parseString( hello ))
+