Skip to content

Commit c118f94

Browse files
authored
1 parent d73aad7 commit c118f94

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/Language/grammars.pod6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ succeed assertion.
274274
275275
In the action class, we use calls to the C<succ> method to do set up (in this
276276
case, we prepare a new element in C<@!numbers>). In the C<digit> method,
277-
we convert an Arabic digit into a Devanagari digit and add it to the last
278-
element of C<@!numbers>. Thanks to C<succ>, the last element will always be
279-
the number for the currently parsed C<digit> digits.
277+
we use the Arabic digit as an index into a list of Devanagari digits and add
278+
it to the last element of C<@!numbers>. Thanks to C<succ>, the last element
279+
will always be the number for the currently parsed C<digit> digits.
280280
281281
grammar Digifier {
282282
rule TOP {
@@ -288,7 +288,7 @@ the number for the currently parsed C<digit> digits.
288288
289289
class Devanagari {
290290
has @!numbers;
291-
method digit ($/) { @!numbers[*-1] ~= $/.ord.&[+](2358).chr }
291+
method digit ($/) { @!numbers.tail ~= <० १ २ ३ ४ ५ ६ ७ ८ ९>[$/] }
292292
method succ ($) { @!numbers.push: '' }
293293
method TOP ($/) { make @!numbers[^(*-1)] }
294294
}

0 commit comments

Comments
 (0)