Author: bernhard
Date: Sun Mar 25 07:46:21 2007
New Revision: 17725
Modified:
trunk/languages/plumhead/src/antlr3/Plumhead.g
trunk/languages/plumhead/src/partridge/Plumhead.pg
trunk/languages/plumhead/t/hello.t
Log:
[Plumhead partridge]
Partial support for
'no semicolon needed at end of PHP code block'
Modified: trunk/languages/plumhead/src/antlr3/Plumhead.g
==============================================================================
--- trunk/languages/plumhead/src/antlr3/Plumhead.g (original)
+++ trunk/languages/plumhead/src/antlr3/Plumhead.g Sun Mar 25 07:46:21 2007
@@ -45,7 +45,7 @@
fragment IDENT : { codeMode }?=> ( 'a'..'z' | 'A'..'Z' | '_' )(
'a'..'z' | 'A'..'Z' | '_' | '0'..'9' )*;
VAR_NAME : { codeMode }?=> '$' IDENT ;
-fragment DIGITS : { codeMode }?=> ('0'..'9' )+ ;
+fragment DIGITS : { codeMode }?=> ( '0'..'9' )+ ;
INTEGER : { codeMode }?=> DIGITS ;
NUMBER : { codeMode }?=> DIGITS? '.' DIGITS ;
Modified: trunk/languages/plumhead/src/partridge/Plumhead.pg
==============================================================================
--- trunk/languages/plumhead/src/partridge/Plumhead.pg (original)
+++ trunk/languages/plumhead/src/partridge/Plumhead.pg Sun Mar 25 07:46:21 2007
@@ -44,8 +44,8 @@
rule relational_expression { <expression> <rel_op_clause>? }
rule statement {
- <ECHO> <expression> ;
- | <VAR_DUMP> <?PAREN_OPEN> <expression> <?PAREN_CLOSE> ;
+ <ECHO> <expression> ( ; | <?before: \? > | $ )
+ | <VAR_DUMP> <?PAREN_OPEN> <expression> <?PAREN_CLOSE> ( ; | <?before: \? >
| $ )
| <IF> <?PAREN_OPEN> <relational_expression> <?PAREN_CLOSE> \{ <statement>*
\} <else_clause>?
| <inline_sea>
| <scalar_assign>
@@ -57,8 +57,8 @@
rule rel_op_clause { <REL_OP> <expression> }
rule else_clause { <?ELSE> \{ <statement>* \} }
token inline_sea { <?CODE_END> <SEA_empty_allowed> <?CODE_START> }
-rule scalar_assign { <var> <ASSIGN_OP> <expression> ; }
-rule array_assign { <array_elem> <ASSIGN_OP> <expression> ; }
+rule scalar_assign { <var> <ASSIGN_OP> <expression> ( ; | <?before:
\? > | $ ) }
+rule array_assign { <array_elem> <ASSIGN_OP> <expression> ( ; |
<?before: \? > | $ ) }
token expression { <DOUBLEQUOTE_STRING>
| <SINGLEQUOTE_STRING>
Modified: trunk/languages/plumhead/t/hello.t
==============================================================================
--- trunk/languages/plumhead/t/hello.t (original)
+++ trunk/languages/plumhead/t/hello.t Sun Mar 25 07:46:21 2007
@@ -18,7 +18,7 @@
use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../../../lib";
# core Perl modules
-use Test::More tests => 13;
+use Test::More tests => 14;
# Parrot modules
use Parrot::Test;
@@ -162,3 +162,13 @@
Hello, World!
END_EXPECTED
+
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', 'no semicolon
befor CODE_END' );
+<?php
+echo 'Hello, ';
+echo "World!\n"
+?>
+END_CODE
+Hello, World!
+END_EXPECTED
+