codeimage.io

STUDIO HAZE · image

Topaz source

Open by house policy. Topaz is our own language.

Topaz 5.21 · 113 files

topaz/src/names/scala.tpz

Topaz · 1625 B · Original file

1// Scala backquoted identifier spellings for anonymous names.
3import print { 글자합치기 }
4import structure { 구조노드, 구조입력, 스칼라정수 }
6export function 스칼라정규식별자(이름: string) -> string {
7 let 글자들 = 이름.scalars()
8 if 글자들.length >= 2 && 글자들[0] == "`" && 글자들[글자들.length - 1] == "`" {
9 글자합치기(글자들, 1, 글자들.length - 1)
10 } else { 이름 }
13export function 스칼라감싼식별자인가(구조: 구조입력, 순번: int) -> bool {
14 if 순번 < 0 || 순번 >= 구조.노드들.length { return false }
15 let 노드 = 구조.노드들[순번]
16 if 노드.코드워드 != 416 || 스칼라정수(노드, "childCount") != 1 ||
17 순번 + 1 >= 구조.노드들.length {
18 return false
19 }
20 let 자식 = 구조.노드들[순번 + 1]
21 자식.부모순번 == 순번 && 스칼라정수(자식, "childCount") == 0 &&
22 자식.시작 == 노드.시작 && 자식.끝 == 노드.끝 &&
23 스칼라정수(자식, "startRow") == 스칼라정수(노드, "startRow") &&
24 스칼라정수(자식, "startColumn") == 스칼라정수(노드, "startColumn") &&
25 스칼라정수(자식, "endRow") == 스칼라정수(노드, "endRow") &&
26 스칼라정수(자식, "endColumn") == 스칼라정수(노드, "endColumn")
29export function 스칼라감싼식별자자식인가(구조: 구조입력, 순번: int) -> bool {
30 if 순번 <= 0 || 순번 >= 구조.노드들.length { return false }
31 let 부모순번 = 구조.노드들[순번].부모순번
32 부모순번 + 1 == 순번 && 스칼라감싼식별자인가(구조, 부모순번)

SHA256 273c17bc5bf4cb9458e5d80357721038aa1a58b955d91fed93a0d1a9f284715d