[svn:parrot] r35648 - trunk/languages/pipp/src/pct

[email protected]
Newsgroups perl.cvs.parrot
Message-ID <[email protected]>
Author: bernhard
Date: Fri Jan 16 13:12:47 2009
New Revision: 35648

Modified:
   trunk/languages/pipp/src/pct/actions.pm
   trunk/languages/pipp/src/pct/grammar.pg

Log:
[Pipp] standardize on lowercase token names

Modified: trunk/languages/pipp/src/pct/actions.pm
==============================================================================
--- trunk/languages/pipp/src/pct/actions.pm	(original)
+++ trunk/languages/pipp/src/pct/actions.pm	Fri Jan 16 13:12:47 2009
@@ -119,7 +119,7 @@
     our $?NS;
 
     if $key eq 'open' {
-        $?NS := +$<NAMESPACE_NAME> ?? ~$<NAMESPACE_NAME>[0] !! '';
+        $?NS := +$<namespace_name> ?? ~$<namespace_name>[0] !! '';
     }
     else {
         my $block :=
@@ -176,7 +176,7 @@
 
 method function_call($/) {
     my $past := $( $<argument_list> );
-    $past.name( ~$<FUNCTION_NAME> );
+    $past.name( ~$<function_name> );
 
     make $past;
 }
@@ -213,7 +213,7 @@
 
 method method_call($/) {
     my $past := $( $<argument_list> );
-    $past.name( ~$<METHOD_NAME> );
+    $past.name( ~$<method_name> );
     $past.pasttype( 'callmethod' );
     $past.unshift( $( $<var> ) );
 
@@ -222,7 +222,7 @@
 
 # TODO: Call the default constructor without explicit check, inherit from PippObject instead
 method constructor_call($/) {
-    my $class_name := ~$<CLASS_NAME>;
+    my $class_name := ~$<class_name>;
     # The constructor needs a list of it's arguments, or an empty list
     my $cons_call  := +$<argument_list> ??
                         $( $<argument_list>[0] )
@@ -263,7 +263,7 @@
 method constant($/) {
     our $?NS;
     make PAST::Var.new(
-        :name(~$<CONSTANT_NAME>),
+        :name(~$<constant_name>),
         :scope('package'),
         :namespace($?NS)
     );
@@ -274,8 +274,8 @@
     our $?NS;
     make PAST::Var.new(
         :scope('package'),
-        :namespace( $?NS ~ '\\' ~ $<CLASS_NAME> ~ '::'), 
-        :name(~$<CONSTANT_NAME>)
+        :namespace( $?NS ~ '\\' ~ $<class_name> ~ '::'), 
+        :name(~$<constant_name>)
     );
 }
 
@@ -289,7 +289,7 @@
         PAST::Op.new(
             :pasttype('bind'),
             PAST::Var.new(
-                :name(~$<CONSTANT_NAME>),
+                :name(~$<constant_name>),
                 :isdecl(1),                                                           
                 :scope('package'),
                 :viviself('PhpNull'),
@@ -308,7 +308,7 @@
         PAST::Op.new(
             :pasttype('bind'),
             PAST::Var.new(
-                :name(~$<CONSTANT_NAME>),
+                :name(~$<constant_name>),
                 :isdecl(1),                                                           
                 :scope('package'),
                 :viviself('PhpNull'),
@@ -405,11 +405,11 @@
 
 method array_elem($/) {
     our @?BLOCK;
-    unless @?BLOCK[0].symbol( ~$<VAR_NAME> ) {
-        @?BLOCK[0].symbol( ~$<VAR_NAME>, :scope('lexical') );
+    unless @?BLOCK[0].symbol( ~$<var_name> ) {
+        @?BLOCK[0].symbol( ~$<var_name>, :scope('lexical') );
         @?BLOCK[0].push(
             PAST::Var.new(
-                :name(~$<VAR_NAME>),
+                :name(~$<var_name>),
                 :viviself('PhpArray'),
                 :isdecl(1)
             )
@@ -422,7 +422,7 @@
             :viviself('PhpNull'),
             :lvalue(1),
             PAST::Var.new(
-                :name(~$<VAR_NAME>),
+                :name(~$<var_name>),
                 :viviself('PhpArray'),
                 :lvalue(1),
             ),
@@ -432,11 +432,11 @@
 
 method simple_var($/) {
     our @?BLOCK;
-    unless ( @?BLOCK[0].symbol( ~$<VAR_NAME> ) || @?BLOCK[0].symbol( ~$<VAR_NAME> ~ '_hidden' ) ) {
-        @?BLOCK[0].symbol( ~$<VAR_NAME>, :scope('lexical') );
+    unless ( @?BLOCK[0].symbol( ~$<var_name> ) || @?BLOCK[0].symbol( ~$<var_name> ~ '_hidden' ) ) {
+        @?BLOCK[0].symbol( ~$<var_name>, :scope('lexical') );
         @?BLOCK[0].push(
             PAST::Var.new(
-                :name(~$<VAR_NAME>),
+                :name(~$<var_name>),
                 :viviself('PhpNull'),
                 :isdecl(1)
             )
@@ -445,7 +445,7 @@
 
     make
         PAST::Var.new(
-            :name(~$<VAR_NAME>),
+            :name(~$<var_name>),
             :viviself('PhpNull'),
             :lvalue(1),
         );
@@ -522,7 +522,7 @@
     make $( $/{$key} );
 }
 
-method TRUE($/) {
+method true($/) {
     make PAST::Val.new(
              :value( 1 ),
              :returns('PhpBoolean'),
@@ -530,7 +530,7 @@
          );
 }
 
-method FALSE($/) {
+method false($/) {
     make PAST::Val.new(
              :value( 0 ),
              :returns('PhpBoolean'),
@@ -538,7 +538,7 @@
          );
 }
 
-method NULL($/) {
+method null($/) {
     make PAST::Val.new(
              :value( 0 ),
              :returns('PhpNull'),
@@ -546,7 +546,7 @@
          );
 }
 
-method INTEGER($/) {
+method integer($/) {
     make PAST::Val.new(
              :value( ~$/ ),
              :returns('PhpInteger'),
@@ -554,7 +554,7 @@
          );
 }
 
-method NUMBER($/) {
+method number($/) {
     make PAST::Val.new(
              :value( +$/ ),
              :returns('PhpFloat'),
@@ -575,7 +575,7 @@
 
         # declare the bound vars a lexical
         if +$<bind_list> == 1 {
-            for $<bind_list>[0]<VAR_NAME> {
+            for $<bind_list>[0]<var_name> {
                 $block.symbol( ~$_ ~ '_hidden', :comment('bound with use') );
             }
         }
@@ -607,7 +607,7 @@
     else {
         my $block := @?BLOCK.shift();
 
-        $block.name( ~$<FUNCTION_NAME> );
+        $block.name( ~$<function_name> );
         $block.control('return_pir');
         $block.push( $( $<statement_list> ) );
 
@@ -646,7 +646,7 @@
     else {
         my $block := @?BLOCK.shift();
 
-        $block.name( ~$<METHOD_NAME> );
+        $block.name( ~$<method_name> );
         $block.blocktype( 'method' );
         $block.control('return_pir');
         $block.push( $( $<statement_list> ) );
@@ -658,7 +658,7 @@
 method param_list($/) {
     my $block := PAST::Block.new( :blocktype('declaration'), :node($/) );
     my $arity := 0;
-    for $<VAR_NAME> {
+    for $<var_name> {
         $block.push(
             PAST::Var.new(
                 :name(~$_),
@@ -699,7 +699,7 @@
     our $?CLASS; # for namespacing of constants
 
     if $key eq 'open' {
-        $?CLASS := ~$<CLASS_NAME>;
+        $?CLASS := ~$<class_name>;
         my $block := PAST::Block.new(
                 :node($/),
                 :blocktype('declaration'),
@@ -743,7 +743,7 @@
 
         # declare the attributes
         for $<class_member_definition> {
-            my $member_name := ~$_<VAR_NAME><ident>;
+            my $member_name := ~$_<var_name><ident>;
             $methods_block.symbol(
                 $member_name,
                 :scope('attribute'),
@@ -812,12 +812,12 @@
             $methods_block.push(
                 PAST::Block.new(
                     :blocktype('declaration'),
-                    :name(~$_<VAR_NAME><ident>),
+                    :name(~$_<var_name><ident>),
                     :pirflags(':method'),
                     :node( $/ ),
                     PAST::Stmts.new(
                         PAST::Var.new(
-                            :name(~$_<VAR_NAME><ident>),
+                            :name(~$_<var_name><ident>),
                             :scope('attribute')
                         )
                     )

Modified: trunk/languages/pipp/src/pct/grammar.pg
==============================================================================
--- trunk/languages/pipp/src/pct/grammar.pg	(original)
+++ trunk/languages/pipp/src/pct/grammar.pg	Fri Jan 16 13:12:47 2009
@@ -48,7 +48,7 @@
 }
 
 rule code_echo_tag {
-    <.CODE_START_ECHO_TAG> <argument_list> <.statement_delimiter>
+    <.code_start_echo_tag> <argument_list> <.statement_delimiter>
         <statement_list>
     <.close_short_tag>?
     {*}
@@ -89,7 +89,7 @@
 
 token quoted_lang_name { '"php"' | '\'php\'' }
 
-token CODE_START_ECHO_TAG {     
+token code_start_echo_tag {     
     '<?=' 
     {{ $P0 = new 'String'
        $P0 = "short"
@@ -147,7 +147,7 @@
 }
 
 rule namespace_definition {
-    'namespace' <NAMESPACE_NAME>?  {*}       #= open
+    'namespace' <namespace_name>?  {*}       #= open
     '{' <statement_list> '}'       {*}       #= close
 }
 
@@ -239,40 +239,40 @@
 
 # identifiers
 #
-token CLASS_NAME               { <ident> }
+token class_name               { <ident> }
 
-token CONSTANT_NAME            { <name> }
+token constant_name            { <name> }
 
-token CLASS_CONSTANT_ACCESSOR  { '::' }
+token class_constant_accessor  { '::' }
 
-token STATIC_METHOD_ACCESSOR   { '::' }
+token static_method_accessor   { '::' }
 
-token FUNCTION_NAME            { <ident> }
+token function_name            { <ident> }
 
-token INTERFACE_NAME           { <ident> }
+token interface_name           { <ident> }
 
-token MEMBER_NAME              { <ident> }
+token member_name              { <ident> }
 
-token METHOD_NAME              { <ident> }
+token method_name              { <ident> }
 
 # namespace support
 
-token NAMESPACE_SEPARATOR      { '\\' }
+token namespace_separator      { '\\' }
 
-token NAMESPACE_NAME           { <.name> }
+token namespace_name           { <.name> }
 
 token name {
     | <ident> <morename>*    # no leading backslash
     | <morename>+            # leading backslash
 }
 
-token morename { <.NAMESPACE_SEPARATOR> <ident> }
+token morename { <.namespace_separator> <ident> }
 
-token VAR_NAME                 { '$' <ident> }
+token var_name                 { '$' <ident> }
 
 # terms
 rule method_call {
-    <var> '->' <METHOD_NAME> '(' <argument_list> ')'
+    <var> '->' <method_name> '(' <argument_list> ')'
     {*}
 }
 
@@ -282,7 +282,7 @@
 }
 
 rule function_call {
-    <FUNCTION_NAME> '(' <argument_list> ')'
+    <function_name> '(' <argument_list> ')'
     {*}
 }
 
@@ -303,31 +303,31 @@
 }
 
 rule constructor_call {
-    'new' <CLASS_NAME> [ '(' <argument_list> ')' ]?
+    'new' <class_name> [ '(' <argument_list> ')' ]?
     {*}
 }
 
-token TRUE {
+token true {
     [:i 'TRUE' ]
     {*}
 }
 
-token FALSE {
+token false {
     [:i 'FALSE']
     {*}
 }
 
-token NULL {
+token null {
     'NULL'
     {*}
 }
 
-token NUMBER {
+token number {
     ( \d+ )? '.' \d+
     {*}
 }
 
-token INTEGER {
+token integer {
     \d+
     {*}
 }
@@ -340,12 +340,12 @@
 }
 
 token constant {
-    <CONSTANT_NAME>
+    <constant_name>
     {*}
 }
 
 token class_constant {
-    <CLASS_NAME> <.CLASS_CONSTANT_ACCESSOR> <CONSTANT_NAME>
+    <class_name> <.class_constant_accessor> <constant_name>
     {*}
 }
 
@@ -355,17 +355,17 @@
 }
 
 rule member {
-    <this> '->' <MEMBER_NAME>
+    <this> '->' <member_name>
     {*}
 }
 
 rule array_elem {
-    <VAR_NAME> '[' <expression> ']'
+    <var_name> '[' <expression> ']'
     {*}
 }
 
 token simple_var {
-    <VAR_NAME>
+    <var_name>
     {*}
 }
 
@@ -376,11 +376,11 @@
 }
 
 rule literal {
-    | <TRUE>    {*}    #= TRUE
-    | <FALSE>   {*}    #= FALSE
-    | <NULL>    {*}    #= NULL
-    | <NUMBER>  {*}    #= NUMBER
-    | <INTEGER> {*}    #= INTEGER
+    | <true>    {*}    #= true
+    | <false>   {*}    #= false
+    | <null>    {*}    #= null
+    | <number>  {*}    #= number
+    | <integer> {*}    #= integer
     | <quote>   {*}    #= quote
 }
 
@@ -408,35 +408,35 @@
 }
 
 rule bind_list {
-    'use' '(' [ '&'? <VAR_NAME> [',' '&'? <VAR_NAME>]* ]? ')'
+    'use' '(' [ '&'? <var_name> [',' '&'? <var_name>]* ]? ')'
 }
 
 rule function_definition {
-    'function' <FUNCTION_NAME> <param_list> {*}  #= open
+    'function' <function_name> <param_list> {*}  #= open
     '{' <statement_list> '}'                {*}  #= close
 }
 
 rule param_list {
-    '(' [ '&'? <VAR_NAME> [',' '&'? <VAR_NAME>]* ]? ')'
+    '(' [ '&'? <var_name> [',' '&'? <var_name>]* ]? ')'
     {*}
 }
 
 # OO
 
 rule interface_definition {
-    'interface' <INTERFACE_NAME> [ 'implements' <INTERFACE_NAME> ]? '{'
+    'interface' <interface_name> [ 'implements' <interface_name> ]? '{'
         <method_declaration>*
     '}'
     {*}
 }
 
 rule method_declaration {
-    'function' <METHOD_NAME> <param_list> ';'
+    'function' <method_name> <param_list> ';'
     {*}
 }
 
 rule class_definition {
-    'class' <CLASS_NAME> [ 'implements' <INTERFACE_NAME> ]?  {*}  #= open
+    'class' <class_name> [ 'implements' <interface_name> ]?  {*}  #= open
     '{'
         <class_constant_definition>*
         <class_member_definition>*
@@ -445,23 +445,23 @@
 }
 
 rule class_constant_definition {
-    'const' <CONSTANT_NAME> '=' <literal> <.statement_delimiter>
+    'const' <constant_name> '=' <literal> <.statement_delimiter>
     {*}
 }
 
 # In PHP 5.3 a constand definition outside a declared namespace is forbidden
 # In Pipp this is not checked
 rule namespace_constant_definition {
-    'const' <CONSTANT_NAME> '=' <literal> <.statement_delimiter>
+    'const' <constant_name> '=' <literal> <.statement_delimiter>
     {*}
 }
 
 rule class_member_definition {
-    'public' <VAR_NAME> '=' <literal> <.statement_delimiter>
+    'public' <var_name> '=' <literal> <.statement_delimiter>
 }
 
 rule class_method_definition {
-    'function' <METHOD_NAME> <param_list> {*}  #= open
+    'function' <method_name> <param_list> {*}  #= open
     '{' <statement_list> '}'              {*}  #= close
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.