-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
75 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
node_modules | ||
dist | ||
.idea | ||
params.txt | ||
responses.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,9 +45,7 @@ | |
"test": "jest", | ||
"build": "rimraf dist && tsc", | ||
"release": "semantic-release", | ||
"prepack": "pnpm build", | ||
"params": "ts-node scripts/paramParser.ts", | ||
"responses": "ts-node scripts/responseParser.ts" | ||
"prepack": "pnpm build" | ||
}, | ||
"packageManager": "[email protected]", | ||
"release": { | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from re import match, sub | ||
|
||
raw = "" | ||
while i := input(): | ||
raw += i | ||
raw += "\n" | ||
|
||
items = [ | ||
sub(r" +", " ", " ".join(x).replace("\t", "")) | ||
for x in (x.strip().split(" ") for x in raw.split("\n") if x.strip()) | ||
] | ||
|
||
print(items) | ||
|
||
regex = r"^(.*) (.*)\((필수|선택)\) (.*)$" | ||
result = [] | ||
|
||
|
||
def string_to_type(name: str) -> str: | ||
if name == "STRING": | ||
return "string" | ||
elif name == "INTEGER": | ||
return "number" | ||
else: | ||
raise NotImplementedError("not implemented") | ||
|
||
|
||
for data in items: | ||
matches = match(regex, data) | ||
|
||
if not matches: | ||
print("not matched:", data) | ||
continue | ||
|
||
name, typeName, required, description = matches.groups() | ||
|
||
result.extend( | ||
[ | ||
f"/** {description} */", | ||
f'readonly {name}{"" if required == "필수" else "?"}: {string_to_type(typeName)}', | ||
] | ||
) | ||
|
||
print("\n".join(result)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from re import match, sub | ||
|
||
raw = "" | ||
while i := input(): | ||
raw += i | ||
raw += "\n" | ||
|
||
items = [ | ||
sub(r" +", " ", " ".join(x).replace("\t", "")) | ||
for x in (x.strip().split(" ") for x in raw.split("\n") if x.strip()) | ||
] | ||
|
||
print(items) | ||
|
||
regex = r"^(\d*) (.*) (.*)$" | ||
result = [] | ||
|
||
for data in items: | ||
matches = match(regex, data) | ||
|
||
if not matches: | ||
print("not matched:", data) | ||
continue | ||
|
||
name, description = matches.groups()[1:3] | ||
|
||
result.append(f"/** {description} */") | ||
result.append(f"readonly {name}: str") | ||
|
||
print("\n".join(result)) |
This file was deleted.
Oops, something went wrong.