Author: coke
Date: Fri Mar 28 12:44:16 2008
New Revision: 26600
Modified:
trunk/compilers/json/JSON.pir
trunk/compilers/json/JSON/grammar.pg
trunk/compilers/json/JSON/pge2pir.tg
Log:
[json]
RT #52200
Use the more natural rule name 'value' instead of 'thing',
now that it works.
Modified: trunk/compilers/json/JSON.pir
==============================================================================
--- trunk/compilers/json/JSON.pir (original)
+++ trunk/compilers/json/JSON.pir Fri Mar 28 12:44:16 2008
@@ -51,7 +51,7 @@
.param string json_string
.local pmc parse, match
- parse = get_root_global ['parrot'; 'JSON'], 'thing'
+ parse = get_root_global ['parrot'; 'JSON'], 'value'
$P0 = get_root_global ['parrot'; 'PGE'], 'Match'
match = $P0.'new'(json_string)
Modified: trunk/compilers/json/JSON/grammar.pg
==============================================================================
--- trunk/compilers/json/JSON/grammar.pg (original)
+++ trunk/compilers/json/JSON/grammar.pg Fri Mar 28 12:44:16 2008
@@ -6,14 +6,11 @@
rule array { '[' ']' | '[' <elements> ']' }
rule string { \"<char>*\" }
-rule members { <string> ':' <thing> [',' <string> ':' <thing> ]* }
+rule members { <string> ':' <value> [',' <string> ':' <value> ]* }
-rule elements { <thing> [',' <thing> ]* }
+rule elements { <value> [',' <value> ]* }
-# XXX This should be called 'value', but...
-# RT#40069: [PGE] "value" can't be used as a rule name.
-
-token thing {
+token value {
| <object>
| <array>
| <string>
Modified: trunk/compilers/json/JSON/pge2pir.tg
==============================================================================
--- trunk/compilers/json/JSON/pge2pir.tg (original)
+++ trunk/compilers/json/JSON/pge2pir.tg Fri Mar 28 12:44:16 2008
@@ -4,7 +4,7 @@
.local pmc pir
.local string result
- $S0 = tree.'get'('pir', node, 'thing')
+ $S0 = tree.'get'('pir', node, 'value')
pir = new 'CodeString'
pir.emit('.sub anon :anon')
@@ -16,7 +16,7 @@
.return(pir)
}
-transform pir (thing) {
+transform pir (value) {
.local pmc sub_node, transform_result
.local pmc pir, result
@@ -94,7 +94,7 @@
.local pmc keys
keys = items['string']
- items = items['thing']
+ items = items['value']
.local pmc iter, key_iter, child, key
key_iter = new 'Iterator', keys
@@ -104,7 +104,7 @@
loop:
unless iter goto end
child = shift iter
- $P0 = tree.'get'('pir', child, 'thing')
+ $P0 = tree.'get'('pir', child, 'value')
$S0 = $P0
pir .= $S0
child_result = child['ret']
@@ -138,14 +138,14 @@
items = node['elements']
if null items goto end
- items = items['thing']
+ items = items['value']
.local pmc iter, child
iter = new 'Iterator', items
loop:
unless iter goto end
child = shift iter
- $P0 = tree.'get'('pir', child, 'thing')
+ $P0 = tree.'get'('pir', child, 'value')
$S0 = $P0
pir .= $S0