[svn:parrot] r38298 - in branches/pmc_pct/compilers/pmc: src/parser t t/data
bacek at svn.parrot.org
bacek at svn.parrot.org
Fri Apr 24 13:09:34 UTC 2009
Author: bacek
Date: Fri Apr 24 13:09:33 2009
New Revision: 38298
URL: https://trac.parrot.org/parrot/changeset/38298
Log:
Add few parrot's adverbs to c_argument.
Added:
branches/pmc_pct/compilers/pmc/t/data/class16.pmc
Modified:
branches/pmc_pct/compilers/pmc/src/parser/grammar.pg
branches/pmc_pct/compilers/pmc/t/01-parse.t
Modified: branches/pmc_pct/compilers/pmc/src/parser/grammar.pg
==============================================================================
--- branches/pmc_pct/compilers/pmc/src/parser/grammar.pg Fri Apr 24 12:57:38 2009 (r38297)
+++ branches/pmc_pct/compilers/pmc/src/parser/grammar.pg Fri Apr 24 13:09:33 2009 (r38298)
@@ -68,7 +68,7 @@
}
rule method {
- 'METHOD' <identifier> '(' <c_arguments> ')' <c_body>
+ 'METHOD' <identifier> '(' <parrot_c_arguments> ')' <c_body>
{*}
}
@@ -102,6 +102,22 @@
[ <c_argument> [ ',' <c_argument> ]* ]*
}
+# c_arguments with parrot's adverbs
+rule parrot_c_argument {
+ <c_argument> <adverb>?
+}
+
+rule parrot_c_arguments {
+ [ <parrot_c_argument> [ ',' <parrot_c_argument> ]* ]*
+}
+
+rule adverb {
+ [
+ | ':optional'
+ | ':opt_flag'
+ ]
+}
+
token identifier {
<.ident>
}
Modified: branches/pmc_pct/compilers/pmc/t/01-parse.t
==============================================================================
--- branches/pmc_pct/compilers/pmc/t/01-parse.t Fri Apr 24 12:57:38 2009 (r38297)
+++ branches/pmc_pct/compilers/pmc/t/01-parse.t Fri Apr 24 13:09:33 2009 (r38298)
@@ -5,7 +5,7 @@
.include 'test_more.pir'
load_bytecode 'compilers/pmc/pmc.pbc'
.local int total
- total = 16
+ total = 17
plan(total)
test_parse(total)
Added: branches/pmc_pct/compilers/pmc/t/data/class16.pmc
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/pmc_pct/compilers/pmc/t/data/class16.pmc Fri Apr 24 13:09:33 2009 (r38298)
@@ -0,0 +1,4 @@
+pmclass Foo {
+ METHOD inspect(STRING *what :optional, int has_what :opt_flag) {
+ }
+}
More information about the parrot-commits
mailing list