From 74947d01850c1b96c017e14689e9ca77359ff052 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Tue, 2 Aug 2011 16:59:23 +0900 Subject: examples/keyval2.nim: the indices of the elements of a sequence are numbered starting with zero --- examples/keyval.nim | 2 +- examples/keyval2.nim | 4 ++-- 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 -- cgit 1.4.1-2-gfad0