New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
なでしこの変数管理をObjectからMapに変更する #1638
Comments
lex/parse中の変数管理域となるlocalvarsをobjectからMapに変更するとグローバル変数として 使用不可と明示してエラーメッセージも予約語によるエラーにするのも一案です。 objectを使う「なんちゃってハッシュマップ」は割と問題が潜んでいるかもしれません。 |
@weyk さん、そろそろ、Mapに変更するときが来たのかもしれませんね。 |
kujirahand/nadesiko3core#152 にて作業します。 JavaScriptのMap、Objetctと互換性が低すぎ… |
ObjectはMap(HashMap)のためのものではないですからね。 Plugin向けAPIに必要APIバージョンのようなものを設けて |
ちなみに、以下のコードでだいたい単純置換できますが、何点か文法エラーがでますので、 <?php
$SRC_DIR = './src';
$files = glob($SRC_DIR . '/*.mts');
foreach ($files as $file) {
echo "file: $file\n";
$content = file_get_contents($file);
$lines = explode("\n", $content);
$new_lines = [];
foreach ($lines as $line) {
$line2 = preg_replace('#__v0\[(.+?)\] = (.+)#', '__setSysVar($1, $2)', $line);
if ($line != $line2) {
echo "+ $line2\n";
$new_lines[] = $line2;
continue;
}
$line2 = preg_replace('#__v0\[(.+?)\]#', '__getSysVar($1)', $line);
if ($line != $line2) {
echo "- $line2\n";
$new_lines[] = $line2;
continue;
}]
$new_lines[] = $line;
}
// save
$new_content = implode("\n", $new_lines);
file_put_contents($file, $new_content);
} あ、上記だけではだめで、__varslist[0]、[1]、[2]を置換します。 |
変数constructorが定義できない問題。
[エラー][文法エラー]main.nako3(1行目): 構文解析でエラー。『変数』の使い方が間違っています。
The text was updated successfully, but these errors were encountered: