Skip to content

Commit

Permalink
docs: apply API changes to document
Browse files Browse the repository at this point in the history
  • Loading branch information
rycont committed Nov 17, 2024
1 parent 84b1056 commit a0cf356
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 40 deletions.
2 changes: 1 addition & 1 deletion docs/library/2. 런타임에서 변수 가져오기.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ console.log(result.scope.getVariable('내_이름').value)
자세히 알아보려면 다음 문서를 참조하세요:

- [Runtime 클래스](/api/classes/Runtime)
- [FileRunner 클래스](/api/classes/FileRunner)
- [CodeFile 클래스](/api/classes/CodeFile)
- [Scope 클래스](/api/classes/Scope)
43 changes: 5 additions & 38 deletions runtest.ts
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)
3 changes: 2 additions & 1 deletion src/mod.ts
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'

0 comments on commit a0cf356

Please sign in to comment.