-
Notifications
You must be signed in to change notification settings - Fork 3
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
3 changed files
with
8 additions
and
40 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
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,41 +1,8 @@ | ||
import { yaksok } from '@yaksok-ts/core' | ||
|
||
yaksok({ | ||
코레일: ` | ||
약속, (차종)으로 (거리)km을 이동할 때 운임 | ||
만약 차종 = @차종 KTX이음 이면 | ||
만약 거리 <= 60 이면 | ||
결과: 8400 | ||
아니면 | ||
결과: 8400 + (거리 - 60) * 140.2 | ||
const code = ` | ||
내_이름: "영희" | ||
` | ||
|
||
만약 차종 = @차종 무궁화호 이면 | ||
만약 거리 <= 40 이면 | ||
결과: 2600 | ||
아니면 | ||
결과: 2600 + (거리 - 40) * 65 | ||
약속, 출발하기 | ||
"빵빵" 보여주기 | ||
`.trim(), | ||
main: ` | ||
"청량리부터 안동까지 KTX 이음을 타면" 보여주기 | ||
(@코레일 (@차종 KTX이음)으로 (@역간거리 "청량리" 부터 "안동" 까지)km을 이동할 때 운임) + "원" 보여주기 | ||
"판교부터 충주까지 무궁화호를 타면" 보여주기 | ||
(@코레일 (@차종 무궁화호)으로 (@역간거리 "판교" 부터 "충주" 까지)km을 이동할 때 운임) + "원" 보여주기 | ||
@코레일 출발하기 | ||
`, | ||
역간거리: ` | ||
약속, (역1)부터 (역2)까지 | ||
만약 역1 = "청량리" 이고 역2 = "안동" 이면 | ||
결과: 235.3 | ||
만약 역1 = "판교" 이고 역2 = "충주" 이면 | ||
결과: 140.9 | ||
`, | ||
차종: ` | ||
KTX이음: "KTX-이음" | ||
무궁화호: "무궁화호" | ||
`, | ||
}) | ||
const result = yaksok(code) | ||
console.log(result.scope.getVariable('내_이름').value) |
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,11 +1,12 @@ | ||
export { CodeFile } from './type/code-file.ts' | ||
export { yaksok, Runtime } from './runtime/index.ts' | ||
export type { RuntimeConfig } from './runtime/runtime-config.ts' | ||
|
||
export { Scope } from './executer/scope.ts' | ||
export * from './node/index.ts' | ||
|
||
export { tokenize } from './prepare/tokenize/index.ts' | ||
|
||
export type { RuntimeConfig } from './runtime/runtime-config.ts' | ||
export type { FunctionParams } from './constant/type.ts' | ||
export type { FEATURE_FLAG } from './constant/feature-flags.ts' | ||
export type * from './error/index.ts' |