少しずつ Slowly but surely.
celtic@sohma:~/code/linux/rubyex/translator$ ./parser
puts -3
puts - 3
Program: 2 expression(s).
FuncCallExpr: puts(arguments)
LiteralTypedExpr<i>: -3
FuncCallExpr: Expr.-(arguments)
IdentifierExpr: puts
LiteralTypedExpr<i>: 3
celtic@sohma:~/code/linux/rubyex/translator$
正しい結果です。もっと一つの問題な場合だけあります:
It's the correct result. We've just got one more problem case remaining:
"puts-3"はまだ"puts(-3)"と同じくパースしています。puts-3
Program: 1 expression(s).
FuncCallExpr: puts(arguments)
LiteralTypedExpr<i>: -3
"puts-3" is still being parsed like "puts(-3)".
RubyExのlexerは今"-3"が読んだらLiteralTypedExpr<int>(-3)をemitします。以前は"3.-@"、でもこうはもっと柔軟だと思う。
RubyEx's lexer is now reading "-3" and emitting LiteralTypedExpr<int>(-3). Earlier it was emitting "3.-@", but this way is probably more flexible.
