diff options
author | Keita Haga <keitahaga@gmx.com> | 2011-08-02 16:59:23 +0900 |
---|---|---|
committer | Keita Haga <keitahaga@gmx.com> | 2011-08-02 16:59:23 +0900 |
commit | 74947d01850c1b96c017e14689e9ca77359ff052 (patch) | |
tree | ce13fc258b6e371f4516e6d23a0fd0da7699fbaa | |
parent | f0145ba7c5142b2ea7da8c77522600a251145875 (diff) | |
download | Nim-74947d01850c1b96c017e14689e9ca77359ff052.tar.gz |
examples/keyval2.nim: the indices of the elements of a sequence are numbered starting with zero
-rwxr-xr-x | examples/keyval.nim | 2 | ||||
-rwxr-xr-x | examples/keyval2.nim | 4 | ||||
-rwxr-xr-x | examples/myfile.txt | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/keyval.nim b/examples/keyval.nim index 19a430a1e..ae8cb8f08 100755 --- a/examples/keyval.nim +++ b/examples/keyval.nim @@ -3,7 +3,7 @@ import re for x in lines("myfile.txt"): if x =~ re"(\w+)=(.*)": - echo "Key: ", matches[0], + echo "Key: ", matches[0], " Value: ", matches[1] diff --git a/examples/keyval2.nim b/examples/keyval2.nim index 5e7d0ea4a..2a5643276 100755 --- a/examples/keyval2.nim +++ b/examples/keyval2.nim @@ -3,5 +3,5 @@ import pegs for x in lines("myfile.txt"): if x =~ peg"{\ident} \s* '=' \s* {.*}": - echo "Key: ", matches[1], - " Value: ", matches[2] + echo "Key: ", matches[0], + " Value: ", matches[1] diff --git a/examples/myfile.txt b/examples/myfile.txt index 1df0d56f8..fb7cda984 100755 --- a/examples/myfile.txt +++ b/examples/myfile.txt @@ -6,6 +6,6 @@ asdflksadlfasf adsfljksadfl -key=/usr/bin/value +key=/usr/bin/value key2=/ha/ha |