Skip to content

Commit

Permalink
增加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
LiXiaYu committed Jan 31, 2022
1 parent a570c83 commit c38688c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test_files/asteria.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
auto a = [ ];
auto b = [ ];

auto test( auto x, auto y, auto z) {
x.length = 0, x[0] = "hello"; // modifies the array that `x` would reference
Expand Down
3 changes: 2 additions & 1 deletion test_files/asteria.mate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
let outFileContent=srcFileContent;
//let_to_auto
outFileContent=outFileContent.replaceAll(/(^|[\s\n\r])let([\s\n\r])/g, "$1auto$2");
console.log("let_to_auto\n", outFileContent);

//function_to_auto
let matches=outFileContent.matchAll(/(^|[\s\n\r])(function)([\s\n\r])(\S+)(\s*)(\()((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*)(\))/g);
let functionkeywordSnumber=2;
let parameterSnumber=7;
let addLength=0;
for (let match of matches) {
//parameter to auto parameter
let parameterstring=match[parameterSnumber];
// 1 - 6 elements string length sum
let index=match.index;
Expand Down Expand Up @@ -43,6 +43,7 @@
outFileContent=outFileContent.substring(0,index)+newparameterstring+outFileContent.substring(index+length);
addLength+=newparameterstring.length-length;

//function keyword to auto
let function_index=match.index;
for(let i=1;i<functionkeywordSnumber;i++)
{
Expand Down

0 comments on commit c38688c

Please sign in to comment.