Permalink
Browse files

ajouter des pointsvirgules pour que ca marche mieux pour generer les …

…pointsvirgules du php aux bons endroits dans les bons contextes
  • Loading branch information...
1 parent 6ebeab8 commit c55dfae7a375f458348a91162092df9dc5b12ea5 Julien Desrosiers committed Aug 30, 2009
Showing with 209 additions and 159 deletions.
  1. +1 −2 compiled.php
  2. +12 −4 grammar.y
  3. +13 −13 input.aw
  4. +2 −1 nodes.rb
  5. +155 −121 parser.rb
  6. +17 −9 phlower.rb
  7. +9 −9 tests.rb
View
@@ -21,8 +21,7 @@ function z(){
}
$poulet = true;
-if ($poulet->to_i();
-) {
+if ($poulet->to_i()) {
$aw = new Awesome("brilliant!",2);
$pouti = $aw->x();
$awe = $aw->init()->x()->z();
View
@@ -87,13 +87,21 @@ rule
# A method call
Call:
# method(arguments)
- IDENTIFIER "(" ArgList ")" { result = CallNode.new(nil, val[0], val[2]) }
+ IDENTIFIER "(" ArgList ")" { result = CallNode.new(nil, val[0], val[2], false) }
# receiver.method
- | Expression "." IDENTIFIER { result = CallNode.new(val[0], val[2]) }
+ | Expression "." IDENTIFIER { result = CallNode.new(val[0], val[2], false) }
# receiver.method(arguments)
| Expression "."
- IDENTIFIER "(" ArgList ")" { result = CallNode.new(val[0], val[2], val[4]) }
- | Expression BinaryOperator Expression { result = CallNode.new(val[0], val[1], [val[2]]) }
+ IDENTIFIER "(" ArgList ")" { result = CallNode.new(val[0], val[2], val[4], false) }
+ | Expression BinaryOperator Expression { result = CallNode.new(val[0], val[1], [val[2]], false) }
+ # VERSION WITH ; AT THE END
+ | IDENTIFIER "(" ArgList ")" Terminator { result = CallNode.new(nil, val[0], val[2], true) }
+ # receiver.method
+ | Expression "." IDENTIFIER Terminator { result = CallNode.new(val[0], val[2], nil, true) }
+ # receiver.method(arguments)
+ | Expression "."
+ IDENTIFIER "(" ArgList ")" Terminator { result = CallNode.new(val[0], val[2], val[4], true) }
+ | Expression BinaryOperator Expression Terminator { result = CallNode.new(val[0], val[1], [val[2]], true) }
;
Array:
View
@@ -1,23 +1,23 @@
def pass():
- echo("joie")
+ echo("joie");
class Awesome:
def init():
- pass()
+ pass();
def x():
- return(2 + 2)
+ return(2 + 2);
def z():
- print("poulet")
+ print("poulet");
-poulet = true
-if poulet.to_i:
- aw = Awesome.new("brilliant!",2)
- pouti = aw.x()
- awe = aw.init().x().z()
- print(awe)
+poulet = true;
+
+if poulet.to_i():
+ aw = Awesome.new("brilliant!",2);
+ pouti = aw.x();
+ awe = aw.init().x().z();
+ print(awe);
else:
- weird()
- arr = ["joie",2]
-
+ weird();
+ arr = ["joie",2];
View
@@ -67,10 +67,11 @@ def eval(context)
# receiver.method(argument1, argument2)
#
class CallNode < Awesome
- def initialize(receiver, method, arguments=[])
+ def initialize(receiver, method, arguments=[], is_end=false)
@receiver = receiver
@method = method
@arguments = arguments
+ @is_end = is_end
end
def eval(context)
Oops, something went wrong.

0 comments on commit c55dfae

Please sign in to comment.