STUDIO HAZE · image
Topaz source
Open by house policy. Topaz is our own language.
Topaz 5.21 · 113 files
topaz/src/names/coffeescript.tpz
Topaz · 2126 B · Original file
1
// CoffeeScript reserved words and interpolation names that anonymous names avoid.3
import names.ascii { 아스키식별자계속, 아스키식별자시작 }4
import print { 글자합치기 }5
import util { 문자열배열에있음 }7
export function 커피스크립트예약이름(이름: string) -> bool {8
문자열배열에있음([9
"and", "arguments", "await", "break", "by", "catch", "class",10
"continue", "debugger", "delete", "do", "else", "eval", "extends",11
"false", "finally", "for", "from", "function", "if", "in",12
"instanceof", "is", "isnt", "loop", "new", "no", "not", "null",13
"of", "off", "on", "or", "own", "return", "super", "switch",14
"then", "this", "throw", "true", "try", "typeof", "undefined",15
"unless", "until", "when", "while", "yes", "yield"16
], 이름)17
}19
// CoffeeScript 보간 본문은 실행 코드다. 바깥 리터럴의 #{...} 구간만20
// 읽어 그 안의 ASCII 식별자를 예약한다. 중첩 보간은 중괄호 깊이로21
// 함께 들어오며, 이 보수적 집합은 살아 있는 이름을 별칭이 가리는22
// 방향만 막는다.23
export function 커피스크립트보간이름들(글: string) -> Array<string> {24
let 글자들 = 글.scalars()25
let mut 이름들: Array<string> = []26
let mut 깊이 = 027
let mut 색인 = 028
while 색인 < 글자들.length {29
if 색인 + 1 < 글자들.length && 글자들[색인] == "#" &&30
글자들[색인 + 1] == "\{" {31
깊이 = 깊이 + 132
색인 = 색인 + 233
continue34
}35
if 깊이 > 0 && 글자들[색인] == "\{" {36
깊이 = 깊이 + 137
색인 = 색인 + 138
continue39
}40
if 깊이 > 0 && 글자들[색인] == "\}" {41
깊이 = 깊이 - 142
색인 = 색인 + 143
continue44
}45
if 깊이 > 0 && 아스키식별자시작(글자들[색인]) {46
let 시작 = 색인47
색인 = 색인 + 148
while 색인 < 글자들.length && 아스키식별자계속(글자들[색인]) {49
색인 = 색인 + 150
}51
이름들.push(글자합치기(글자들, 시작, 색인))52
continue53
}54
색인 = 색인 + 155
}56
이름들57
}SHA256 9bc3d2f7bce4d6a13e144ce21868a9ec4d0db045c8aa83c0b2ebd546895964ee